> I have a MySQL query that works great, but the IF statement I
> can't get to work in MS SQL ... anyone dare to help out
>
> SELECT s.speciesID, s.speciesName,
> IF(sf.speciesFusionID IS NULL, "0", "1")
> FROM uoaSpecies s
> LEFT JOIN uoaSpeciesFusion sf
> ON (s.speciesID = sf.speciesID AND sf.coID = #url.coID#)
>
> <!---- This is the problem line --->
> IF(sf.speciesFusionID IS NULL, "0", "1")
>
> Basically if speciesFusionID IS NULL then I want
> speciesFusionID to be 0 if it isn't, I want it to be 1
SELECT ..., speciesFusionID =
CASE
WHEN sf.speciesFusion IS NULL THEN '0'
ELSE '1'
END
Dave Watts, CTO, Fig Leaf Software
http://www.figleaf.com/
Fig Leaf Software provides the highest caliber vendor-authorized
instruction at our training centers in Washington DC, Atlanta,
Chicago, Baltimore, Northern Virginia, or on-site at your location.
Visit http://training.figleaf.com/ for more information!
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Message: http://www.houseoffusion.com/lists.cfm/link=i:4:242162
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54