If you're using Oracle, 

SELECT decode(Gender, 1, 'M', 2, 'F','N/A') AS GenderAbbr
FROM Users

Decode is the Oracle function like an 'IF' loop. So if it's 1 then put 'M',
if 2 then put 'F' else put 'N/A'

Alex

-----Original Message-----
From: Tyler Clendenin [mailto:[EMAIL PROTECTED]]
Sent: Thursday, March 21, 2002 8:55 AM
To: CF-Talk
Subject: OT: SQL function i know it exists


Help me please.  I am looking for the SQL function so that i can replace
values i am selecting with other values.  here is an example of how the
function works, if someone could just tell me the name.

say i have a table of users. and i want to select their gender, but the
gender is stored as numbers 1 and 2 but i want to output them as M or F

SELECT FunctionIDontKnow(Gender, 1, 'M', 2, 'F') AS GenderAbbr
FROM Users

The function can have many many pairs of replacement values.

syntax FunctionIDontKnow(column_name, 'column_value', 'replace_with'
[,'column_value', 'replace_with'...])

somepne please help, i know it exists, i ran accross it a few months back
when i was looking for something else.  Now i can't find it again.



______________________________________________________________________
Your ad could be here. Monies from ads go to support these lists and provide more 
resources for the community. http://www.fusionauthority.com/ads.cfm
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to