Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
Blowinup
Starting Member
6 Posts |
Posted - 2010-08-25 : 16:30:22
|
Hello,Ok I couldn't even figure out how to Google this question much less title the subject properly... so please bear with. :^)I'm wondering if there is a way to have query results restructured if it meets a given criteria. For example, I have a row that returns just one letter. Each letter corresponds to word; i.e. F=Faxed, P=Printed etc.Is there something I can write into the query that will automatically display the f as Faxed, the p as printed, etc? Something like: select date, name, id, status from table where status = ‘f’ DISPLAY AS ‘Faxed’ and where status = ‘p’ DISPLAY AS ‘PrintedI know I can easily handle this after the fact but I’d really like to know if it’s possible.Thanks!dave |
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2010-08-25 : 16:36:47
|
SELECT CASE Status WHEN 'F' THEN 'Faxed' WHEN 'P' THEN 'Printed' ELSE 'Unknown' ENDFROM Table1 N 56°04'39.26"E 12°55'05.63" |
 |
|
Blowinup
Starting Member
6 Posts |
Posted - 2010-08-25 : 18:11:59
|
What a beautifully elegant answer... Thanks you very much!!!RESOLVED |
 |
|
|
|
|