Mam takie zapytanie:
SELECT i.imageid, i.categoryid, i.username, i.path, i.filename, i.title, i.viewcount, i.comcount, i.downloadcount, i.created, c.title AS categorytitle
FROM _images i
LEFT JOIN _categories c ON ( c.categoryid = i.categoryid )
WHERE (
i.usergroupids = 'all'
OR i.usergroupids LIKE '%(1)%'
)
AND i.actived =1
AND c.actived =1
ORDER BY i.ordernum DESC
LIMIT 0 , 10
Chcę dorzucić jeszcze coś w stylu COUNT( x.commentid ) AS ileKomentarzy i zapytanie zmienia sie na:
SELECT COUNT( x.commentid ) AS ileKomentarzy, i.imageid, i.categoryid, i.username, i.path, i.filename, i.title, i.viewcount, i.comcount, i.downloadcount, i.created, c.title AS categorytitle
FROM _images i, _comments x
LEFT JOIN _categories c ON ( c.categoryid = i.categoryid )
WHERE (
i.usergroupids = 'all'
OR i.usergroupids LIKE '%(1)%'
)
AND i.actived =1
AND c.actived =1
ORDER BY i.ordernum DESC
LIMIT 0 , 10
ale wywala błąd: #1054 - Nieznana kolumna 'i.categoryid' w on clause.