__ select letters.*,
max(lfdi.end) as data_nadania,
min(replace(o_p.sorting_form, " UNKNOWN", "ZZZZZUNK")) as first_addressee, (select min(number) from letter_publications as letter_p where letter_p.idl=letters.id and letter_p.number!="") as ceid_number,
max(lfdi1.end) as data_nadania_nie_po
from letters
LEFT JOIN letter_from_date_interval as lfdi1 on lfdi1.idl=letters.id
LEFT JOIN letter_from_date_interval as lfdi on lfdi.idl=letters.id
left join text_person as letter_t on letter_t.text_id=letters.id
left join objects_persons as o_p on letter_t.person=o_p.id
where letters.id="6240" and letter_t.text_type="letter" and letter_t.role="2"
group by letters.id
__
QUERY ERROR!
Too many connections
List
Nie znaleziono rekordów pasujących do podanych kryteriów