"SELECT prods.id as id, prods.name, parties.name as partyname, downloadlinks.link, prods.partycompo, prods.party_place, g1.name as g1name, g2.name as g2name, g3.name as g3name ".
" FROM downloadlinks ".
" LEFT JOIN prods on prods.id = downloadlinks.prod ".
" LEFT JOIN parties on parties.id = prods.party ".
" LEFT JOIN groups as g1 on g1.id = prods.group1 ".
" LEFT JOIN groups as g2 on g2.id = prods.group2 ".
" LEFT JOIN groups as g3 on g3.id = prods.group3 ".