Sample Header Ad - 728x90

return field name and number of rows which meet condition in one sentence

0 votes
1 answer
93 views
I have a table in postgres with 10 fields, and need to check for certain values in 3 of them, then return the field name which met the condition and the number of rows in each field. So it's something like:
select count(*)
from table
where field1 ilike '%E+%'
OR field2 ilike '%E+%'
OR field3 ilike '%E+%'
and then return the field which met the condition AND the number of rows (which I'm not sure how to do it)
Asked by Matias (141 rep)
Jul 8, 2020, 01:55 PM
Last activity: Jul 8, 2020, 02:03 PM