Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
rwlopez
Yak Posting Veteran
80 Posts |
Posted - 2006-11-14 : 13:08:57
|
| Is there a way to use an IF or CASE statement within the SELECT statement of a query.For ExampleSELECT SalesPersonID, SalesPersonID, IF(SalesRegion = 'CA','Y','') AS CaliforniaSalespersonFROM SalesPerson |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2006-11-14 : 13:10:55
|
| Have you tried to search SQLTeam and put in effort yourself? No...SELECT SalesPersonID, SalesPersonID, CASE WHEN SalesRegion = 'CA' THEN 'Y' ELSE 'N' END AS CaliforniaSalespersonFROM SalesPersonPeter LarssonHelsingborg, Sweden |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2006-11-15 : 09:59:07
|
| Note that IIF will work in Access. CASE WHEN is its sql server equivalentMadhivananFailing to plan is Planning to fail |
 |
|
|
|
|
|