|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Learn five alternative approaches for automating the delivery of Excel-based reports. Read all about it in the free whitepaper: “Automating Excel Reports: Five Approaches for Java Developers” Download Now!
|
|
#1
|
|||
|
|||
|
I would like to be able to query a table which contains 3 fields with identical information and return the value from any of those fields based on a pecking order. The pecking order would be like this: field a, field b, field c. If field a contains data, the returned value would be the value of field a even if fields b & c contain data
since field a is highest in the pecking order. If field a contains no data, then the value of field b would be returned. The last check would be to return the data in field c if none was found in either a or b. Since I am lazy, I am looking for the simplest solution. Thanks in advance for any help you can give me. |
|
#2
|
||||
|
||||
|
assuming that "If field a contains no data" means null, this is the simplest solution:
select coalesce(fielda,fieldb,fieldc) from yourtable rudy http://r937.com/ |
![]() |
| Viewing: Dev Shed Forums > Databases > MS SQL Development > return value from 3 fields into 1 field |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|