SELECT * FROM usrs, usr_lookup WHERE usr_lookup.usr_name = usrs.usr_name AND usr_lookup.opts_table = 1 AND ( usr_lookup.usr_opt = 8 ) AND usr_lookup.opts_table = 1 AND ( usr_lookup.usr_opt = 12 ) usr_lookup.opts_table = 2 AND ( usr_lookup.usr_opt = 4 );
Ok so what I want as results:
So i want it to return all the records in the usrs table that have records in the usr_lookup table that have the a specific value for opts_table and usr_opt
Table: usr_lookup
usr 100
opts_table 1
usr_opt 8
usr 120
opts_table 1
usr_opt 12
usr 100
opts_table 2
usr_opt 4
usr 120
opts_table 2
usr_opt 4
I understand how to use foreach in PHP but I don't understand how to structure the query properly. Any help would be greatly appriciated!