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 2000 Forums
 SQL Server Administration (2000)
 sql query

Author  Topic 

Keshaba
Yak Posting Veteran

52 Posts

Posted - 2008-01-03 : 07:44:12
I want to write a query Comapring 3 tables named TabFittingDetals,
TyreFittingDetails,and TabInventory.I want to load only those tyreno which is present in TabFittingDetails But not in TyreFittingDetails and TabInventory.


With 2 tables I had written like this
"select ItemCode,TyreNo from TyreIssueDetails where vehno = 'AS063388' and ItemCode = 'Tyre' And TyreIssueDetails.TyreNo Not in (select TyreNo from TabFittingDetails)"


Keshab

harsh_athalye
Master Smack Fu Yak Hacker

5581 Posts

Posted - 2008-01-03 : 07:53:36
[code]Select ...
From TabFittingDetails t1 LEFT JOIN
(Select tyreno from TyreFittingDetails
union all
Select tyreno from TabInventory) t2
on t1.tyreno = t2.tyreno
where t2.tyreno Is Null[/code]

Harsh Athalye
India.
"The IMPOSSIBLE is often UNTRIED"
Go to Top of Page
   

- Advertisement -