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
Register Now and get your question answered!
Save Password
Forgot your Password?

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Sub Query on Assets
 Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Starting Member

22 Posts

Posted - 06/24/2013 :  21:07:52  Show Profile  Reply with Quote

I want to display all assets regardless of status, but if any assets are disposed, then only show disposed assets from 1 Jan 2011. I used a sub query, but it only displayed disposed assets eg

select * from asset where siteid = 'fleet' and assetnum in (select * from asset where dispdate > '2010-12-31').


In (Som, Ni, Yak)

17689 Posts

Posted - 06/24/2013 :  21:40:21  Show Profile  Reply with Quote
select *
from   asset
where  siteid = 'fleet'
and    (dispdate is null or dispdate >= '2011-01-01')

Time is always against us

Edited by - khtan on 06/24/2013 21:41:09
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.03 seconds. Powered By: Snitz Forums 2000