Oleg Shapar
4/8/2005 9:52:00 AM
AOOO OOE OAAIEAU - ?IOOA?YEEE, OI?AO E OE? OI?AOA
supplier
------------
id
name
goods
------------
id
name
supplier_id
goods_type
goods_type
------------
id
name
description
OE?I? OI?AOI? IAIIICI, 5 EIE 6 (O.A. OIIO?AOO?AIII 5 EIE 6 UA?EOAE ?
goods_type)
IIA IOOII ?IO?EOAOO OEIIOEI OI?AOI? EAOAICI OE?A AIN EIIEOAOIICI
?IOOA?YEEA, AOIE OI?AO OAEICI OE?A IOOOOOO?OAO, OI ?U?AOOE 0.
N ?EUO
select goods_type.id as gt, count(*) from goods_type left join goods on
goods_type.id = goods.goods_type where supplier_id = 10 group by gt;
IIA ?U?IAEO ?OEIAOIIA OAEIA
+------------+----------+
| goods_type | count(*) |
+------------+----------+
| 1 | 25 |
+------------+----------+
A IAAI ?OEIAOIIA OAEIA
+------------+----------+
| goods_type | count(*) |
+------------+----------+
| 1 | 25 |
+------------+----------+
| 2 | 0 |
+------------+----------+
| 3 | 0 |
+------------+----------+