mysql not exists returns empty set -


i have table called today_unit_names following column names:

id, unit_id, unit_name, name_type_id 

there 4 name_type_id (1,2,3,4).

i want write query find of unit_id do not have unit_name name_type_id=4 existing in records. here i've tried. returns empty set.

select `un`.`unit_id` `today_unit_names` `un`  not exists(            select `un`.`unit_id`            `today_unit_names` `un`            `un`.`name_type_id`='4'        ) order `unit_id` 

select unit_id today_unit_names name_type_id <> 4 , unit_name = '' 

last condition optional, if need unit_name empty


Comments

Popular posts from this blog

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

html - How to style widget with post count different than without post count -

url rewriting - How to redirect a http POST with urlrewritefilter -