Groups | Blog | Home
all groups > sql server mseq > october 2003 >

sql server mseq : Help with query


Newbie
10/16/2003 5:42:40 PM
Hi
I want to be able to return a set of records from one table that don't
appear in the resultset of another query.

Eg
InvMove table has details of all stock movements
InvMaster has details ALL stockcodes

Select Stockcode from InvMove M inner join InvMaster I On M.Stockcode =
I.Stockcode Where Date >='01/01/2003'

I then want to use the results of this query and get all the Stockcodes from
the InvMaster table that DO NOT appear in the resultset of the above query

How can I achieve this?

Nigel Rivett
10/18/2003 11:26:54 PM
select t.Stockcode
from InvMaster t
left outer join
(Select distinct Stockcode from InvMove M
Where Date >='01/01/2003') a
on a.Stockcode = t.Stockcode
where a.Stockcode is null

AddThis Social Bookmark Button