I want to create a new table from an existing table that has numeric values. I want to be able to classify my data into two groups based on how high the number is. If the number is over 20 then it needs to go into group 'High", if it's below that then group 'Low'.
My existing table looks something like this
task A | Days in progress |
---|---|
Task 1 | 22 |
Task 2 | 31 |
Task 3 | 55 |
Task 4. | 100 |
I know this is probably a case when mixed with something else, but I'm not sure where the existing table information needs to be called, and how I can just get the values that I'm now trying to count into a new column.
I saw this earlier and tried working with it:
SELECT
COUNT(CASE WHEN rsp_ind = 0 then 1 ELSE NULL END) as "New",
COUNT(CASE WHEN rsp_ind = 1 then 1 ELSE NULL END) as "Accepted"
from tb_a
I initially started here with an example:
SELECT COUNT (T1.'days in progress') AS '<=7'
FROM T1
WHERE 'days in progress'<=7
;
using sql count in a case statement
I tired building my own SQL query.