Welcome to my blog, hope you enjoy reading
RSS

Thursday, 27 June 2013

Using If Condition In Select Query in mysql

Using If Condition In Select Query in mysql

For Example

select If(Amt>0,'Yes','no')
from 
product

the above is not working

Solution:

Select Case
When Amt > 0 Then 'Yes'
Else 'No'
End AliasYourColumnHere
From Product

0 comments: