modify value from select quey on the fly

G

GiuseppeDini

I have a query like this:

select f1, f2, f3 from table

If f1 has value 'cod1' or 'cod23' I have to make very similar
operazions on the records, so I would like to treat them as they would
be the same.
What I need is a query which adds a colums that has the same value of
column f1, except when it's 'cod1' or 'cod23' in which case I want it
to be 'cod1-23'.


For example:

f1 | f2 | f3
------------------------
cod1 | xx | 33
cod6 | ee | rr
cod23| r4 | gh
cod7 | 33 | ty


I want to become:

f1b | f1 | f2 | f3
--------------------------------------------
cod1-23 | cod1 | xx | 33
cod6 | cod6 | ee | rr
cod1-23 | cod23| r4 | gh
cod7 | cod7 | 33 | ty


Is it possible?

Giuseppe
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top