Page 1 of 1

1054 error (wrong sql query?)

Posted: 29 Oct 2015, 20:42
by ruster1969
I've tried to order categories by rating.
Now I got this error:

1054
Unknown column 'r.count' in 'order clause' SQL=SELECT a.id FROM jos_phocagallery AS a LEFT JOIN jos_phocagallery_categories AS cc ON cc.id = a.catid WHERE a.catid= 2 AND a.published = 1 AND a.approved = 1 ORDER BY r.count ASC, a.id ASC


Column count is not missing (it's in jos_phocagallery_categories).

IMHO the issue is in the query, in the part ORDER BY r.count... r is alias for which table? :roll:

I guess that the correct query is
SELECT a.id FROM jos_phocagallery AS a LEFT JOIN jos_phocagallery_categories AS cc ON cc.id = a.catid WHERE a.catid= 2 AND a.published = 1 AND a.approved = 1 ORDER BY cc.count ASC, a.id ASC

Re: 1054 error (wrong sql query?)

Posted: 31 Oct 2015, 12:31
by ruster1969
If only I could know where to find that query... I can't find which file contains it :(

Re: 1054 error (wrong sql query?)

Posted: 01 Nov 2015, 21:59
by Jan
Hi, thank you for info, quick fix:

download: https://www.phoca.cz/forumfiles/model_category.zip

unzip it and copy it to your server: components\com_phocagallery\models\

This should solve the problem.

Please let me know, so I can add it to next version.

Jan

Re: 1054 error (wrong sql query?)

Posted: 02 Nov 2015, 12:32
by ruster1969
Jan wrote:Hi, thank you for info, quick fix:

download: https://www.phoca.cz/forumfiles/model_category.zip

unzip it and copy it to your server: components\com_phocagallery\models\

This should solve the problem.

Please let me know, so I can add it to next version.

Jan
Hi Jan,
thank you, problem solved! :twisted:

Re: 1054 error (wrong sql query?)

Posted: 03 Nov 2015, 01:40
by Jan
Hi, great to hear it, I will implement it to newest version.

Thank you for the info.

Jan

Re: 1054 error (wrong sql query?)

Posted: 07 Dec 2015, 01:59
by Jan
Hi, set in version 4.2.2

Jan