- Back to Home »
- MYSQL »
- Using IF..ELSE in UPDATE Query
Posted by : ஆனந்த் சதாசிவம்
Thursday, June 6, 2013
Using IF..ELSE in UPDATE:
SQL:
Select Query:
select propertyid,e.name as username,case p.bactive when 1 then 'tick.gif' else 'cross.gif' end as bActive from tbl_Property p inner join enquiry e on p.userid=e.enqiry_id"
Update Query:
update tbl_Property set bactive=(case bactive when '1' then '0' else '1' end) where propertyid=14