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
 Sub Query on Assets
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

sonjan
Starting Member

Australia
22 Posts

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

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').

Thanks
Sonja

khtan
In (Som, Ni, Yak)

Singapore
17584 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')



KH
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  
 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.04 seconds. Powered By: Snitz Forums 2000