18 | | JOIN TAGOVI t ON d.idTag = t.idTag |
19 | | JOIN PREFERENCI p ON p.idKorisnik = d.idDest |
20 | | LEFT JOIN RECENZII r ON r.idDest = d.idDest |
21 | | WHERE d.tipoviMesta LIKE '%море%' |
22 | | AND d.preporachanaSezona = 'лето' |
23 | | AND p.prioritet >= 7 |
24 | | AND r.ocena >= 4 |
25 | | AND r.datumPoseta >= CURDATE() - INTERVAL 30 DAY |
26 | | AND r.idRecenzija IS NOT NULL |
27 | | ORDER BY d.popularnost DESC, d.prosechnaTemp DESC; |
| 18 | LEFT JOIN RECENZII r ON d.idDest = r.idDest |
| 19 | LEFT JOIN ( |
| 20 | SELECT idDest, COUNT(*) AS brKomentari |
| 21 | FROM KOMENTARI |
| 22 | GROUP BY idDest |
| 23 | ) k ON d.idDest = k.idDest |
| 24 | WHERE d.tipoviMesta LIKE '%[внесен тип на место]%' |
| 25 | AND d.idTag IN (SELECT idTag FROM TAGOVI WHERE tagOznaka LIKE '%[внесен приоритет]%') |
| 26 | AND d.preporachanaSezona LIKE '%[внесена сезона]%' |
| 27 | AND r.kvalitet >= [минимална оценка] |
| 28 | AND r.datumRecenzija >= '[датум на последна посета]' |
| 29 | AND (k.brKomentari > 0 OR k.brKomentari IS NULL); |