php - MySQLi- How to get number of records in one table that do not match values in another table -


this question has answer here:

sorry obscure title... don't know how best explain this.

i have 2 tables, valid_sizes , items

valid_sizes:

id    sizeid    description 1     40        small 2     41        medium 3     42        large 

items:

id    size 1     41 2     41 3     40 4     99 5     42 6     98 

i attempting perform query finds how many items exist size not exist in valid_sizes table. in instance, query return 2. (items 4 , 6 not exist sizeid)

how done?

something should work. want left join, , check null results.

   select * items     left join valid_sizes on items.sizeid = valid_sizes.size          size null; 

Comments

Popular posts from this blog

sublimetext3 - what keyboard shortcut is to comment/uncomment for this script tag in sublime -

java - No use of nillable="0" in SOAP Webservice -

ubuntu - Laravel 5.2 quickstart guide gives Not Found Error -