database - Required help in a query -
i wanted take count of records based on condition.
here's condition is.
data:
"col1" "col2" "col3 y y y y n y n y n y y y n y b y n b y y b n y b n n b y y b n y c y n c y y c n y c y y c n y c y y
i need take count of y
col3
excluding n
of col2
col1
value a
. head cracking when think of doing it.
note : n
values of col2 must excluded col1 value a. null values need included along y
passing criteria col3 value y
.
please me.
i need count 11
if query correct.
code tried with.
select 'yes' "label", count(*) table1 "date" between '2014-03-01' , '2014-03-05' , "col3" = 'y' , ("col1" 'c' , "col2" 'n')
i have idea how orally. couldn't figure out way in postgresql
.
try this:
select 'yes' "label", count(*) table1 "date" between '2014-03-01' , '2014-03-05' , col3 = 'y' , not (col1='a' , col2 not null , col2='n')
Comments
Post a Comment