sql server - select rows from table and check if condition at column in sql -


i have check rows table , check if-else condition each rows

table: report

columns : sl.no, count, total_count, calls

sample data:

sl.no       count       total_count calls ----------- ----------- ----------- ----------- 1           2           6           4 2           2           7           5 3           4           9           3 

here have check if condition

 if total_count > 6  select 'y  else  select 'n' 

i correct answer single row. if there multiple row can't check all, check last row of table.

use case expression

select     *,     case when total_count > 6 'yes' else 'n' end report 

Comments

Popular posts from this blog

node.js - Mongoose: Cast to ObjectId failed for value on newly created object after setting the value -

[C++][SFML 2.2] Strange Performance Issues - Moving Mouse Lowers CPU Usage -

ios - Possible to get UIButton sizeThatFits to work? -