I'm not sure of the exact syntax off the top of my head, but I think you
want to change your IF statement to a CASE statement. Research
transact-SQL case statements and I think you will find what you need.
It's going to be something like:
select s.speciesID, s.speciesName,
case sf.speciesFusionID when null then 0 else 1 end as 'speciesFusionID'
......
Steve
Paul Giesenhagen wrote:
> 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
>
>
>
> Paul Giesenhagen
> QuillDesign
> 417-885-1375
> http://www.quilldesign.com
>
>
>
>
>
>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Message: http://www.houseoffusion.com/lists.cfm/link=i:4:242168
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=11502.10531.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54