MYSQL selecting from table 1 with conditions from 2nd table -


my first table, called emp employees table, information such names, phone numbers, town, etc.

my second table, called loc table of cities , country’s in. - in list there less cities there in 1st table. (the purpose of cities list irrelevant atm)

i want pull list (select from) of name , phone number used select name,number full_list , worked - want show employees live in cities in "cities" column in 'loc' tablet. want display country if possible.

i tired stuff like

select name,number full_list city cities 

but didnt work.

edit: wanted add exact keys make simpler

table 1:

emplist name    number 

table 2:

cities city   country 

this wanted "checked" against city column in tablet 1, if there match, want appear.

column 2 country want appear if possible.

ty

try this:

select f.name, f.number  emplist e inner join cities c on (c.primary_key = e.foreign_key) c.cities '%your city%'; 

change keys table keys...


Comments

Popular posts from this blog

java - Intellij Synchronizing output directories .. -

git - Initial Commit: "fatal: could not create leading directories of ..." -