View Single Post
Old 12-17-2012, 01:48 AM   PM User | #4
Old Pedant
Supreme Master coder!

 
Old Pedant's Avatar
 
Join Date: Feb 2009
Posts: 23,249
Thanks: 59
Thanked 3,999 Times in 3,968 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
By the way, since this *IS* the MYSQL forum, my answers above are for MySQL queries.

If you are using Access, then you simply change IF to IIF in my first post.

If you are using SQL Server, you would have to use CASE WHEN in place of IF

The answers in the second post should work for most any DB.
__________________
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 offline   Reply With Quote