SELECT gkuplatfiz.*,gkuorg.*,gkuur.* FROM(SELECT `Depart` ,`RepPer` as `RepPer1`, sum(`KolObrMP`) as `KolObrMP2`, sum(`KolEkzMP`) as `KolEkzMP2`, sum(`KolObrPD`) as `KolObrPD2`, sum(`KolEkzPD`) as `KolEkzPD2`, sum(`KolObrKP`) as `KolObrKP2`, sum(`KolEkzKP`) as `KolEkzKP2`, sum(`KolObrKV`) as `KolObrKV2`, sum(`KolEkzKV`) as `KolEkzKV2`, sum(`KolObrKPT`) as `KolObrKPT2`, sum(`KolEkzKPT`) as `KolEkzKPT2` FROM `gkuplat_ur` WHERE `RepPer`>='02' AND `RepPer`<='02' GROUP BY `Depart`) as gkuur INNER JOIN (SELECT `Depart` as `Dep1`,`RepPer` as `RepPer2`, sum(`KolObrMP`) as `KolObrMP1`, sum(`KolEkzMP`) as `KolEkzMP1`, sum(`KolObrPD`) as `KolObrPD1`, sum(`KolEkzPD`) as `KolEkzPD1`, sum(`KolObrKP`) as `KolObrKP1`, sum(`KolEkzKP`) as `KolEkzKP1`, sum(`KolObrKV`) as `KolObrKV1`, sum(`KolEkzKV`) as `KolEkzKV1`, sum(`KolObrKPT`) as `KolObrKPT1`, sum(`KolEkzKPT`) as `KolEkzKPT1` FROM `gkuplat_org` WHERE `Depart` LIKE '%' GROUP BY `Dep1`) as `gkuorg` ON gkuur.Depart=gkuorg.Dep1 INNER JOIN `gkuplatfiz` ON gkuur.Depart=gkuplatfiz.Depart WHERE `RepPer`>='02' AND `RepPer`<='02' AND `RepPer2`= '02' AND `RepGod`>='2011' AND `RepGod`<='2011' GROUP BY `Dep1`,`RepPer2`,`RepPer`,`RepPer1`
выдается только одна запись. не могу понять в чем причина
В каждой из 3-х таблиц есть поля отчетный год отчетный месяц и район.
Мне нужно чтобы по заданию параметров из формы HTML допустим месяц февраль год 2011 выдавалось что-то вроде
Depart Kol1 | Kol2| Kol3|
Depart2 Kol1 | Kol2 |Kol3|
и т д
Посмотрите свежим взглядом, а то я запарился совсем