I have a table where there 2 columns. F1 and F2. Now F1 has Id and F2 has score.
F1 Score
1 10
1 20
6 10
now I want to have a where clause where it considers 6 as 1 and adds them with 1
for example when I use when F1=1 it should give
F1 Score
1 10
1 20
1 10
I have used
WHERE (F1 = CASE WHEN F1 =6 THEN 1 ELSE F1 END )
but not working.
You seem to want:
select (case when f1 = 6 then 1 else f1 end) as new_f1,
score
from t
order by new_f1;
EDIT:
You changed the question. For filtering, you would simply do:
where f1 in (1, 6)
Try this:
select (case when F1 = 6 then 1 else F1 end) as something, SCORE
from your_table
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.