[thelist] SQL: Birthday report

rudy r937 at interlog.com
Fri Oct 18 11:05:10 CDT 2002

>           < RIGHT(birthdate,5)
> Can someone (rudy maybe? :) explain what this does?

it evaluates to 1 or 0

thanks for the kind words, but that's not actually my sql, i lifted it from
the example on mysql.com

an expression comparing two dates with an inequality yields a true or false
result, and mysql happens to treat this as a 1 or 0, and as you can see,
this result is happily subtracted from some other number

in sql/server, you might use a CASE construct, if the inequality comparison
expression trick doesn't work (i can't test it, sorry)

note that there are a couple of those comparison expressions


More information about the thelist mailing list