Reputation: 905
I am editing a query that creates a View. I added a case which search for records with field equal to specific values and output an int value like 3 to the View column called Status.I am working off a server and don't want to save the query to the view. I ran the query and it produces new status values like '3' in the column. I am not sure how to count the occurrence of record with status of 3 in the View query. how do I do that? I don't want to save the query and then run query against the View. I would like to execute the query and produce a count of record with value of Status = 3
Thanks
select
rtrim(p.PP) as Id,
(case (p.PC) when '17' then 'B' when 'W' then 'NN' end) as Company,
rtrim(p.PP as Number,
'Application' as [Type],
(case end) as [Status],
'--' as [Source],
case end as Channel,
case
when p.PENDP_PRODDESC like '%associaterm%' then 1
else 0
end as IsPrivate,
case
when (r.COLUMN1 = 'P' and (r.COLUMN2 = 'IC') then '3'
else '0'
end as Status,
p.PR_IND as RS
from MY_TABL as p
left join U_TABL as tu on p.PC = tu.U_COMPANY and p.PP = tu.U_TUNUMBER
Upvotes: 0
Views: 32
Reputation: 1066
select count(*)
from (<paste your select here>) as vw_sql
where vw_sql.status = '3'
Upvotes: 1