Click here to Skip to main content
11,481,404 members (66,894 online)
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C#
how should I write for select statement including if else condititon

I write as below statement and give error, so how should I write for that

ORDER.Order_Id as 'id',
ORDER.Released
IF(ORDER.Released = 1) PRINT 'Released'
ELSE PRINT 'Not Released'
from ORDER

thanks,
ttds
Posted 17-Jan-13 16:54pm
ttds828
Edited 17-Jan-13 18:14pm
v2
Comments
PIEBALDconsult at 17-Jan-13 22:12pm
   
I can't tell what you want, but maybe you want CASE ORDER.Released THEN 'Released' ELSE 'Not Released' END
PIEBALDconsult at 17-Jan-13 22:12pm
   
Are you looking for

CASE ORDER.Released WHEN 1 THEN 'Released' ELSE 'Not Released' END?


Oh, sure, now the earlier post shows up. :rolleyes:

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

This should do it

SELECT
    O.Order_ID AS 'id',
    O.Released,
    CASE WHEN O.Released = 1 THEN 'Released' ELSE 'Not Released' END AS ReleaseStatus
FROM Order AS O
  Permalink  
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



Advertise | Privacy | Mobile
Web01 | 2.8.150520.1 | Last Updated 17 Jan 2013
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100