oracle - Check all values of a column in a group to be same -
oracle - Check all values of a column in a group to be same -
i have below set of values in result set,
col1 col2 col3 col4 col5 m cp c no t1 m cp c no t2 m cp c no t3 m cp yes t4 m cp may t5 m cp no t6 m cp d why t7 m cp e no t8 query) values of col5 values of col4=no after grouping on col1,col2 , col3 . how achive using single query in oracle.
e.g: status satisfied grouping ( m cp c values t1,t2,t3) , grouping ( m cp e - value of t8)
i mean in grouping rows should have value "no" col4.
please suggest.
if understand correctly, query may help:
select col1, col2, col3, col4, col5 from(select col1, col2, col3, col4, col5, count(*) on (partition col1, col2, col3) cnt1, count(*) on (partition col1, col2, col3, col4) cnt2 your_table ) col4 = 'no' , cnt1 = cnt2; oracle
Comments
Post a Comment