Please start any new threads on our new site at We've got lots of great SQL Server experts to answer whatever question you can come up with.

Our new SQL Server Forums are live! Come on over! We've restricted the ability to create new threads on these forums.

SQL Server Forums
Profile | Active Topics | Members | Search | Forum FAQ
Save Password
Forgot your Password?

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 One to Many Date Filter
 Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Yak Posting Veteran

76 Posts

Posted - 03/01/2013 :  14:38:19  Show Profile  Reply with Quote
Good afternoon. I have a query that needs to filter out any records that do not have a modifydate entry after 1/1/2009

Here are the code:

select a.account,b.modifydate
from sql1.sysdba.Account A
left outer join sql1.sysdba.Opportunity B ON b.accountid = b.accountid
where b.modifydate < '2009-01-01 00:00:00.00'

This code works except in my test data one record has 168 entries in the opportunity table, and some are greater that the above date. What this means is that record "a" should NOT be on the list/output.

Sorry for the long explanation, any ideas ?


Bryan Holmstrom

James K
Flowing Fount of Yak Knowledge

3873 Posts

Posted - 03/01/2013 :  16:37:18  Show Profile  Reply with Quote
	sql1.sysdba.Account A
	inner join sql1.sysdba.Opportunity B
		ON b.accountid = b.accountid 
	SELECT * FROM sql1.sysdba.Opportunity x
	WHERE x.modifydate >= '20090101'
	AND x.accountid = b.accountid
Go to Top of Page
  Previous Topic Topic Next 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.02 seconds. Powered By: Snitz Forums 2000