ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Using Case in MSquery (https://www.excelbanter.com/excel-programming/348351-using-case-msquery.html)

LBIdydys

Using Case in MSquery
 
Is there a way to use case functionality in MSQuery like in tsql.
Example
Select Job,
Case trantype
when 1 then amount
when 2 then amount *-1
end as Amt
from tblJob

Ron Coderre[_5_]

Using Case in MSquery
 
Try this:

Select Job,
(amount*CHOOSE(trantype,1 ,-1)) AS Amt
from tblJob


Does that help?

***********
Regards,
Ron

XL2002, WinXP-Pro


"LBIdydys" wrote:

Is there a way to use case functionality in MSQuery like in tsql.
Example
Select Job,
Case trantype
when 1 then amount
when 2 then amount *-1
end as Amt
from tblJob



All times are GMT +1. The time now is 05:26 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com