Harald Fuchs wrote:
That's correct, but it can be written shorter and clearer:
CASE Lccation
WHEN 1 THEN 'Downstairs Cat Room'
WHEN 2 THEN 'Kitten Room'
WHEN 3 THEN 'Quarantine'
ELSE 'Unknown' END AS Location
- surely it would be better to have the location ids and location names
in a lookup table, and simply write the query as a join between the
animals table and the locations table? Hard-coding the meaning of ids
into the code itself is never a good idea.
- ian
--
+-------------------------------------------------------------------+
| Ian Sales Database Administrator |
| |
| "If your DBA is busy all the time... |
| ...he's not doing his job properly" |
| eBuyer http://www.ebuyer.com |
+-------------------------------------------------------------------+
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]