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)
 query problem

Author  Topic 

pelolori
Starting Member

15 Posts

Posted - 2010-12-04 : 10:50:58
Hi,
i've three table

table A:
field Docentry,Docnum,DocDate
Table B:
Field Docentry(JOIN with A),Item Code, DocDate, Ref1,Docdate
Table C:
Field Ref1( JOIN with B),Itemcode, Docdate

i want to extract all DocNum from A where A.Docdate is different from C.DoCDate
how can i get this information by query sql?

pk_bohra
Master Smack Fu Yak Hacker

1182 Posts

Posted - 2010-12-04 : 12:57:26
Try:

Select A.Docentry, A.DocNum, A.DocDate, C.DocDate as CDocDate
from tablea A inner join tableb B on A.Docentry = B.Docentry
inner join TableC C on B.Ref1 = C.Ref1
and A.DocDate <> C.DocDate

Regards,
Bohra

I am here to learn from Masters and help new bees in learning.
Go to Top of Page
   

- Advertisement -