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.