View Single Post
Old 10-22-2012, 09:52 PM   PM User | #4
Old Pedant
Supreme Master coder!

 
Old Pedant's Avatar
 
Join Date: Feb 2009
Posts: 23,227
Thanks: 59
Thanked 3,996 Times in 3,965 Posts
Old Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to all
IIF in Access is virtually identical to IF in MySQL.

You should be able to just change IIF to IF

You can't use [....] with MySQL. Use `...` instead (those are backticks, the character on same keyboard key as the ~ tilde)
Except you didn't need the [...] in Access and you don't need backticks in MySQL, either.

And you should use apostrophes instead of quotes. MySQL will take either, but quotes are not ANSI compliant.


Code:
SELECT If( Network_1=-1,'Net-1',
                         If(Network_2=-1,'Net-2',
                                         If(Network_3=-1,'Net-3','')
                         )
       ) AS Network
But your ID #4 would mean a different approach, completely.
__________________
An optimist sees the glass as half full.
A pessimist sees the glass as half empty.
A realist drinks it no matter how much there is.
Old Pedant is online now   Reply With Quote
Users who have thanked Old Pedant for this post:
MaDmiX (10-23-2012)