Afternoon,We have a master table with a range of numbers like so:BegTag EndTag---------- ----------3260 33093310 33293330 33693370 3384
I have another table where users data enter the tags into an inventory table:TagNumber----------3620362136333612212236342753
I'm trying to find out what tags haven't been entered yet. I tried this but with no luck:select TagNumberfrom dbo.InventoryWipTags where TagNumber not IN(select * from dbo.InventoryTagMaster where PhysInvDate = '2010-02-18' AND TagNumber between min(BegTag) AND max(EndTag))
I get the error message:Msg 147, Level 15, State 1, Line 6An aggregate may not appear in the WHERE clause unless it is in a subquery contained in a HAVING clause or a select list, and the column being aggregated is an outer reference.Msg 116, Level 16, State 1, Line 6Only one expression can be specified in the select list when the subquery is not introduced with EXISTS.
Can anyone think of a slick way to do this that wont yell at me?Thanks in advance.Laura