SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Uncommon record within a date range
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

sql_101
Starting Member

2 Posts

Posted - 01/31/2013 :  17:10:12  Show Profile  Reply with Quote
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

India
52309 Posts

Posted - 02/01/2013 :  02:42:32  Show Profile  Reply with Quote
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
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.08 seconds. Powered By: Snitz Forums 2000