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
 General SQL Server Forums
 New to SQL Server Programming
 Uncommon record within a date range

Author  Topic 

sql_101
Starting Member

2 Posts

Posted - 2013-01-31 : 17:10:12
hi,

i'm trying to find uncommon records within a date range. i'm somewhat successful, but i only get records for the first date of my criteria not the rest of them.

this is what i wrote :

SELECT item1, @date
FROM table1
WHERE item1 NOT IN
(
SELECT item
FROM table2
WHERE Date >= CONVERT(datetime, @Date) AND
Date <= DATEADD(DAY, 2, CONVERT(datetime, @Date)))

as i said, i only get the first day's record, but not the other days in the range.

can anyone help me? i'm using sql 7

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2013-02-01 : 02:42:32
i didnt get your exact scenario. what are table1,table2 etc? which is table that contain range values and from which table you're trying to select? show some sample data and explain what you want

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

Go to Top of Page
   

- Advertisement -