Bitterman
Новичок
UserAleks
[sql]
SELECT COUNT(DISTINCT t1.firm_id)
FROM `sto_firma` as t1
left join sto_makes_firma as t2 on t1.firm_id = t2.firm_id
left join sto_uslugi_firma as t3 on t1.firm_id = t3.firm_id
WHERE
t1.firm_open='1'
AND t1.sity_zip='90008'
AND ( t2.makes_name='audi' OR t2.makes_name='bmw' )
AND ( t3.us_id='5' OR t3.us_id='8') group by t1.firm_id;
[/sql]
так?
))
[sql]
SELECT COUNT(DISTINCT t1.firm_id)
FROM `sto_firma` as t1
left join sto_makes_firma as t2 on t1.firm_id = t2.firm_id
left join sto_uslugi_firma as t3 on t1.firm_id = t3.firm_id
WHERE
t1.firm_open='1'
AND t1.sity_zip='90008'
AND ( t2.makes_name='audi' OR t2.makes_name='bmw' )
AND ( t3.us_id='5' OR t3.us_id='8') group by t1.firm_id;
[/sql]
так?
