mysql - Some sort of join statement? -
how put these 2 queries single query?
select count(id) cnt {$site_id}.proofingv2_packages active='1' select count(id) cnt {$site_id}.proofingv2_package_options active='1' , parent={$row["id"]} order sort
$row['id']
id field first query. trying determine if there valid packages. valid package must active , have @ least 1 active option. running 2 queries doesn't seem right.
can help?
select count(id) cnt {$site_id}.proofingv2_packages pp inner join {$site_id}.proofingv2_package_options pt on pp.active = pt.active , pp.active = 1
if id pk or fk on same on both tables use query
select count(id) cnt {$site_id}.proofingv2_packages pp inner join {$site_id}.proofingv2_package_options pt on pp.id= pt.id , pp.active = 1
Comments
Post a Comment