Sunday, April 1, 2012

Equi-join in MySQL

Here's and example:
select
distinct site_scripts._id,
crw_site.site,
crw_subcategory.subcategory
from site_scripts,
crw_site ,
crw_subcategory
where site_scripts.subcategory_id = 8
and crw_site._id
= site_scripts._id
and crw_subcategory.subcategory_id
= site_scripts.subcategory_id
and crw_scripts.country_id = 1
and crw_site._active = 1
order by crw_site.site;
Note: The concept can be used as an alternate to inner join...

0 comments:

Post a Comment