Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 Compare value

Author  Topic 

LOOKUP_BI
Constraint Violating Yak Guru

295 Posts

Posted - 2011-09-19 : 15:35:55
I have a table A with following clmns, ( ID (int), Date (datetime), Value (float))

I have a view B with following clmns ( ID (int), Date (datetime), Value (float))

View B is a 'SELECT * FROM table C' in Access 2000 database. This is establish using a Linked Server Connection

In Table C (Access), I have the following columns (ID (NUMBER), DATE (date/time) , Value (Number)(Filed size : Double))

Im trying to locate the combination of ID's, Date & Return that is there in Table A and not in View B , by using the following query

SELECT * FROM A a WHERE NOT EXISTS
(SELECT b.ID,b.[DATE],b.[Value] FROM LinkedServerName...B b
WHERE a.ID=b.ID AND
a.[AS_OF_DATE]=b.[Date]
AND a.[value]=b.[value])
ORDER BY a.ID

There are times it also returns the matching data.

How can I match the Value column correctlty ?

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2011-09-20 : 02:55:27
does ID be also having same values on both the objects (A & B)

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

LOOKUP_BI
Constraint Violating Yak Guru

295 Posts

Posted - 2011-09-20 : 09:06:30
Yes ID has same values, but I need to use the combination of the 3 columns to consider a unique value.
Go to Top of Page
   

- Advertisement -