On Nov 21, 2007, at 13:16 , john@msasystems.net wrote:
> Hi,
>
> i have a:
> select * from foo where type = 1 and score > 12;
>
> i would like to say
>
> select * from foo where type = QUARTERBACK and
> score > 12;
You should have a table which enumerates your types, so you can do
something like:
SELECT *
FROM foo
JOIN foo_types USING (type)
WHERE foo_types.type = 'quarterback'
AND score > 12;
Magic numbers in a database (or anywhere else for that matter) is not
a good idea.
(Or use the enum types in 8.3, currently beta3)
Michael Glaesemann
grzm seespotcode net