I was exploring someone’s code and I have found this query.This query is fetching data using join. But there is no use of inner join, outer join, left or right. The programmer simply writes this query.
I found this is the SMART way of writing query, if this query is right ?
SELECT
a.*,b.*,c.*,d.*,e.*
FROM
property_photos a,property_promotions b,properties c, communities d,cities e
WHERE
a.property_id = b.property_id AND
a.property_id = c.id AND
(b.promotion_id =2 OR b.promotion_id =1) AND
a.mainphoto="Y" AND
d.id=c.community_id AND
e.id = c.city_id AND
a.featured_status = 1
Is this query correct?
It this query is right, the i think, this is more better way to write queries since it will save a lot of disk space instead of use Left join/right Join like words which makes query long
SMARTY WAY
Yes it is alright. It is the same as an INNER JOIN.
Note:
Source: Sam’s – MySQL Crash Course, page 139