Quantcast
Channel: dBforums – Everything on Databases, Design, Developers and Administrators
Viewing all articles
Browse latest Browse all 13329

sql code help

$
0
0
HI all,

Need to know if this is possible...

I need to select a field depeneding on the value of another field.
Example:
Table has fields: ri.cnt, ri.date_1 thru ri.date_99, and other fields.
If the value of ri.cnt = 50, I need to select ri.date_48 (ri.cnt - 2). Is there a way to write this sql code?

The best I could do was:
'ri.ridate_'||cast(ri.ricnt-2 as char(2))

but this only yields ri.ridate_48 as text - not the actual field value.

TIA,
JS-R

Viewing all articles
Browse latest Browse all 13329

Trending Articles