I have a table in this format:
orgkey preferred_flg phonenumber 00111 N 1234566 00111 N 3436456 00111 Y 2388458 00222 N 6634634 00222 N 8834878 00222 N 0034090 00222 N 2736276
I am attempting to get the orgkey which do not have any record with Preferred Flg as Y. For example, from the above sample, I should get
00222 because that orgkey do not have any record with preferred_flg as Y.
I have tried this but it will not give me a
count(*) of 0:
select orgkey, count(*) from phone_table where preffered_flg != 'Y' group by orgkey having count(*) = 0;