join - What is the difference between these two MySQL queries? -
select count( companyid ) companies left join cities on cities.cityid = companies.cityid group companies.companyid;
vs
select count( companyid ) cities left join companies on cities.cityid = companies.cityid group companies.companyid;
what difference?
in first query left table companies , in second query cities.
the left join keyword returns rows left table (table_name1), if there no matches in right table (table_name2).
first query
the left join keyword returns rows companies table , if there no matches in cities table
second query
the left join keyword returns rows cities table , if there no matches in companies table
Comments
Post a Comment