Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Filter Records

Status
Not open for further replies.

jshanoo

Programmer
Apr 2, 2002
287
0
0
IN

Hi all,
Please see my SQl stmt
-------------------------------------------------
Select contract,company,from_date,pin,feedback,
cast(feedback as datetime) as a2,
'Status' =
CASE
WHEN cast(feedback as datetime)> getdate() THEN 'Active'
WHEN cast(feedback as datetime) < getdate() THEN 'Expired'
WHEN cast(feedback as datetime) = getdate() THEN 'Expiring Today'
END
from maininfo
where (from_date between '04/01/2004' and '04/15/2004') and len(feedback) > 0
order by contract-----------------------------------------------
i want to filter according to 'status' field

only records with status='Active'

has to be displayed can any one please help me in this
Regards

John Philip


*** Even the Best, did the Bad and Made the Best ***

John Philip
 
select * from
( Select contract,company,from_date,pin,feedback,
cast(feedback as datetime) as a2,
'Status' =
CASE
WHEN cast(feedback as datetime)> getdate() THEN 'Active'
WHEN cast(feedback as datetime) < getdate() THEN 'Expired'
WHEN cast(feedback as datetime) = getdate() THEN 'Expiring Today'
END
from maininfo
where (from_date between '04/01/2004' and '04/15/2004') and len(feedback) > 0) a
where Status = 'Active' order by contract
 
hi,

But this statement will not work in sql server.

Regards
john philip

*** Even the Best, did the Bad and Made the Best ***

John Philip
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top