Table name listing sql query help required -


i have table table_1 has entries 1 10 , have 20 other tables using values 1 - 10 in column. want list down table names have entries corresponding entry in table_1 missing.

eg :

table_1 has values 1- 10 table_2 using 2 , 5 table_3 using 7,9 , 28 table_4 using 2,7,9 table_5 using 7, 9,76 

so output of query should give me table_3 , table_5

here's 1 way:

select distinct tablename (select 'table_2' tablename, col       table_2       union       select 'table_3' tablename, col       table_3       /*repeat tables*/       union       select 'table_20' tablename, col       table_20) x       left join table_1 t on x.col = t.col t.col null 

Comments

Popular posts from this blog

apache - Remove .php and add trailing slash in url using htaccess not loading css -

javascript - jQuery show full size image on click -