BŁĄD

Błąd wykonania zapytania!
select sum(tdw_twrnumer) as dane, sum(twj_twrnumer) as opakowania, karty.twr_gidnumer,twr_gidtyp,twr_atrybuty,twr_producent,twr_dostawa, karty.twr_nazwa,ceny.twc_cenabrutto, ceny.twc_cenanetto, twr_pojedynczy, tzd_plik, twr_jm, twr_typ, tid_idealid from (b2_twrkarty as karty ,b2_twrgrupylacznik as grupylacznik, b2_twrgrupy) left join b2_twropakowania o on twj_twrnumer = karty.twr_gidnumer and twj_twrtyp = karty.twr_gidtyp left join b2_twrdane d on tdw_twrnumer = karty.twr_gidnumer and tdw_twrtyp = karty.twr_gidtyp left join b2_twrzdjecia z on tzd_twrnumer = twr_gidnumer and tzd_kolejnosc = 0 left join b2_twrceny as ceny on karty.twr_gidnumer = ceny.twc_twrnumer and karty.twr_gidtyp = ceny.twc_twrtyp and twc_typ = 1 left join b2_ideallacznik on twr_gidnumer = tid_twrnumer and twr_gidtyp = tid_twrtyp where twr_esklep = 1 and tgd_esklep = 1 and (tid_idealid is not null or twc_cenabrutto is not null) and tgl_twrtyp = twr_gidtyp and tgl_twrnumer = twr_gidnumer and tgl_tgdtyp = tgd_gidtyp and tgl_tgdnumer = tgd_gidnumer and tgl_twrnumer = twr_gidnumer and tgl_tgdnumer = '40804' group by twr_gidnumer order by twr_nazwa asc