[Skip to main content](#vessel-content)

#   MySQL command error on product list in admin

##

- **[tedfrazier](/forum/user/13305-tedfrazier "View tedfrazier's Profile")**
- [![tedfrazier's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/13305-tedfrazier "View tedfrazier's Profile") Topic Author
- [ Offline](/forum/user/13305-tedfrazier)

Less More

- Posts: 2
- Thank you received: 0
-
-

13 years 9 months ago -  13 years 9 months ago [\#88199](#88199) by [tedfrazier](/forum/user/13305-tedfrazier "View tedfrazier's Profile")  *[MySQL command error on product list in admin](/forum/3-bug-report/77954-mysql-command-error-on-product-list-in-admin#88199 "whenever I try to go here:  . . . /administrator/index.php?option=com&#95;hikashop&amp;ctrl=product  I get this:  An error has occurred. 500 SQL=SELECT a.ordering, b.&#42; FROM hikashop&#95;product&#95;category AS a LEFT JOIN hikashop&#95;product AS b ON a.product&#95;id=b.product&#95;id WHERE a.category&#95;id=2 AND b.product&#95;type = 'main' ORDER BY a.category&#95;name asc LIMIT 0, 20 Error in query: Unknown column 'a.category&#95;name' in 'order clause'")* was created by *[tedfrazier](/forum/user/13305-tedfrazier "View tedfrazier's Profile")*

whenever I try to go here:

. . . /administrator/index.php?option=com_hikashop&amp;ctrl=product

I get this:

An error has occurred.
500 SQL=SELECT a.ordering, b.* FROM hikashop_product_category AS a LEFT JOIN hikashop_product AS b ON a.product_id=b.product_id WHERE a.category_id=2 AND b.product_type = 'main' ORDER BY a.category_name asc LIMIT 0, 20
Error in query: Unknown column 'a.category_name' in 'order clause'

Last edit: 13 years 9 months ago by [tedfrazier](/forum/user/13305-tedfrazier "View tedfrazier's Profile").

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzMtYnVnLXJlcG9ydC83Nzk1NC1teXNxbC1jb21tYW5kLWVycm9yLW9uLXByb2R1Y3QtbGlzdC1pbi1hZG1pbj90bXBsPW1hcmtkb3du) or [Create an account](/register) to join the conversation.

- **[Jerome](/forum/user/80-jerome "View Jerome's Profile")**
- [![Jerome's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar80.png)](/forum/user/80-jerome "View Jerome's Profile")
- [ Offline](/forum/user/80-jerome)
- HikaShop core developer

Less More

- Posts: 26394
- Thank you received: 4078
-
- [](http://obsi.dev)
-

13 years 9 months ago [\#88244](#88244) by [Jerome](/forum/user/80-jerome "View Jerome's Profile")  Replied by *[Jerome](/forum/user/80-jerome "View Jerome's Profile")* on topic *[MySQL command error on product list in admin](/forum/3-bug-report/77954-mysql-command-error-on-product-list-in-admin#88244 "whenever I try to go here:  . . . /administrator/index.php?option=com&#95;hikashop&amp;ctrl=product  I get this:  An error has occurred. 500 SQL=SELECT a.ordering, b.&#42; FROM hikashop&#95;product&#95;category AS a LEFT JOIN hikashop&#95;product AS b ON a.product&#95;id=b.product&#95;id WHERE a.category&#95;id=2 AND b.product&#95;type = 'main' ORDER BY a.category&#95;name asc LIMIT 0, 20 Error in query: Unknown column 'a.category&#95;name' in 'order clause'")*

Hi,

Which version of HikaShop are you using ?

Regards,

---

Jerome - Obsidev.com
HikaMarket &amp; HikaSerial developer / HikaShop core dev team.

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzMtYnVnLXJlcG9ydC83Nzk1NC1teXNxbC1jb21tYW5kLWVycm9yLW9uLXByb2R1Y3QtbGlzdC1pbi1hZG1pbj90bXBsPW1hcmtkb3du) or [Create an account](/register) to join the conversation.

- **[tedfrazier](/forum/user/13305-tedfrazier "View tedfrazier's Profile")**
- [![tedfrazier's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/13305-tedfrazier "View tedfrazier's Profile") Topic Author
- [ Offline](/forum/user/13305-tedfrazier)

Less More

- Posts: 2
- Thank you received: 0
-
-

13 years 9 months ago [\#88253](#88253) by [tedfrazier](/forum/user/13305-tedfrazier "View tedfrazier's Profile")  Replied by *[tedfrazier](/forum/user/13305-tedfrazier "View tedfrazier's Profile")* on topic *[MySQL command error on product list in admin](/forum/3-bug-report/77954-mysql-command-error-on-product-list-in-admin#88253 "whenever I try to go here:  . . . /administrator/index.php?option=com&#95;hikashop&amp;ctrl=product  I get this:  An error has occurred. 500 SQL=SELECT a.ordering, b.&#42; FROM hikashop&#95;product&#95;category AS a LEFT JOIN hikashop&#95;product AS b ON a.product&#95;id=b.product&#95;id WHERE a.category&#95;id=2 AND b.product&#95;type = 'main' ORDER BY a.category&#95;name asc LIMIT 0, 20 Error in query: Unknown column 'a.category&#95;name' in 'order clause'")*

Hikashop version : 2.0.0

Joomla! 3.0.2 Stable

PHP 5.3.20

MySQL 5.5.29

BUT . . . It just now quit giving me that error. I have changed nothing since yesterday. Just logged back in this morning and everything seems to be working again.

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzMtYnVnLXJlcG9ydC83Nzk1NC1teXNxbC1jb21tYW5kLWVycm9yLW9uLXByb2R1Y3QtbGlzdC1pbi1hZG1pbj90bXBsPW1hcmtkb3du) or [Create an account](/register) to join the conversation.

- **[Jerome](/forum/user/80-jerome "View Jerome's Profile")**
- [![Jerome's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar80.png)](/forum/user/80-jerome "View Jerome's Profile")
- [ Offline](/forum/user/80-jerome)
- HikaShop core developer

Less More

- Posts: 26394
- Thank you received: 4078
-
- [](http://obsi.dev)
-

13 years 9 months ago [\#88258](#88258) by [Jerome](/forum/user/80-jerome "View Jerome's Profile")  Replied by *[Jerome](/forum/user/80-jerome "View Jerome's Profile")* on topic *[MySQL command error on product list in admin](/forum/3-bug-report/77954-mysql-command-error-on-product-list-in-admin#88258 "whenever I try to go here:  . . . /administrator/index.php?option=com&#95;hikashop&amp;ctrl=product  I get this:  An error has occurred. 500 SQL=SELECT a.ordering, b.&#42; FROM hikashop&#95;product&#95;category AS a LEFT JOIN hikashop&#95;product AS b ON a.product&#95;id=b.product&#95;id WHERE a.category&#95;id=2 AND b.product&#95;type = 'main' ORDER BY a.category&#95;name asc LIMIT 0, 20 Error in query: Unknown column 'a.category&#95;name' in 'order clause'")*

Hi,

Good thing !
The column category_name exists since a long long time so it was a little bit wired that the column not found except if the installation was not complete.

Regards,

---

Jerome - Obsidev.com
HikaMarket &amp; HikaSerial developer / HikaShop core dev team.

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzMtYnVnLXJlcG9ydC83Nzk1NC1teXNxbC1jb21tYW5kLWVycm9yLW9uLXByb2R1Y3QtbGlzdC1pbi1hZG1pbj90bXBsPW1hcmtkb3du) or [Create an account](/register) to join the conversation.

- **[Rebo2k](/forum/user/19354-rebo2k "View Rebo2k's Profile")**
- [![Rebo2k's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/19354-rebo2k "View Rebo2k's Profile")
- [ Offline](/forum/user/19354-rebo2k)

Less More

- Posts: 22
- Thank you received: 0
-
-
-
-

13 years 5 months ago [\#107548](#107548) by [Rebo2k](/forum/user/19354-rebo2k "View Rebo2k's Profile")  Replied by *[Rebo2k](/forum/user/19354-rebo2k "View Rebo2k's Profile")* on topic *[MySQL command error on product list in admin](/forum/3-bug-report/77954-mysql-command-error-on-product-list-in-admin#107548 "whenever I try to go here:  . . . /administrator/index.php?option=com&#95;hikashop&amp;ctrl=product  I get this:  An error has occurred. 500 SQL=SELECT a.ordering, b.&#42; FROM hikashop&#95;product&#95;category AS a LEFT JOIN hikashop&#95;product AS b ON a.product&#95;id=b.product&#95;id WHERE a.category&#95;id=2 AND b.product&#95;type = 'main' ORDER BY a.category&#95;name asc LIMIT 0, 20 Error in query: Unknown column 'a.category&#95;name' in 'order clause'")*

Hello,

I've got the same problem.

When i tried to sort the name column in de category picker, i got the following error.
I looked in the tables and i saw that there is no column category_name to sort on.

Can you please fix this.

1054 Unknown column 'a.category_name' in 'order clause' SQL=SELECT a.ordering, b.* FROM spa_hikashop_product_category AS a LEFT JOIN spa_hikashop_product AS b ON a.product_id=b.product_id WHERE a.category_id=2 AND b.product_type = 'main' ORDER BY a.category_name asc LIMIT 0, 20

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzMtYnVnLXJlcG9ydC83Nzk1NC1teXNxbC1jb21tYW5kLWVycm9yLW9uLXByb2R1Y3QtbGlzdC1pbi1hZG1pbj90bXBsPW1hcmtkb3du) or [Create an account](/register) to join the conversation.

- **[Jerome](/forum/user/80-jerome "View Jerome's Profile")**
- [![Jerome's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar80.png)](/forum/user/80-jerome "View Jerome's Profile")
- [ Offline](/forum/user/80-jerome)
- HikaShop core developer

Less More

- Posts: 26394
- Thank you received: 4078
-
- [](http://obsi.dev)
-

13 years 4 months ago [\#107683](#107683) by [Jerome](/forum/user/80-jerome "View Jerome's Profile")  Replied by *[Jerome](/forum/user/80-jerome "View Jerome's Profile")* on topic *[MySQL command error on product list in admin](/forum/3-bug-report/77954-mysql-command-error-on-product-list-in-admin#107683 "whenever I try to go here:  . . . /administrator/index.php?option=com&#95;hikashop&amp;ctrl=product  I get this:  An error has occurred. 500 SQL=SELECT a.ordering, b.&#42; FROM hikashop&#95;product&#95;category AS a LEFT JOIN hikashop&#95;product AS b ON a.product&#95;id=b.product&#95;id WHERE a.category&#95;id=2 AND b.product&#95;type = 'main' ORDER BY a.category&#95;name asc LIMIT 0, 20 Error in query: Unknown column 'a.category&#95;name' in 'order clause'")*

Hi,

Same question: Which version of HikaShop are you using ?

Regards,

---

Jerome - Obsidev.com
HikaMarket &amp; HikaSerial developer / HikaShop core dev team.

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzMtYnVnLXJlcG9ydC83Nzk1NC1teXNxbC1jb21tYW5kLWVycm9yLW9uLXByb2R1Y3QtbGlzdC1pbi1hZG1pbj90bXBsPW1hcmtkb3du) or [Create an account](/register) to join the conversation.

- **[Rebo2k](/forum/user/19354-rebo2k "View Rebo2k's Profile")**
- [![Rebo2k's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/19354-rebo2k "View Rebo2k's Profile")
- [ Offline](/forum/user/19354-rebo2k)

Less More

- Posts: 22
- Thank you received: 0
-
-
-
-

13 years 4 months ago [\#107705](#107705) by [Rebo2k](/forum/user/19354-rebo2k "View Rebo2k's Profile")  Replied by *[Rebo2k](/forum/user/19354-rebo2k "View Rebo2k's Profile")* on topic *[MySQL command error on product list in admin](/forum/3-bug-report/77954-mysql-command-error-on-product-list-in-admin#107705 "whenever I try to go here:  . . . /administrator/index.php?option=com&#95;hikashop&amp;ctrl=product  I get this:  An error has occurred. 500 SQL=SELECT a.ordering, b.&#42; FROM hikashop&#95;product&#95;category AS a LEFT JOIN hikashop&#95;product AS b ON a.product&#95;id=b.product&#95;id WHERE a.category&#95;id=2 AND b.product&#95;type = 'main' ORDER BY a.category&#95;name asc LIMIT 0, 20 Error in query: Unknown column 'a.category&#95;name' in 'order clause'")*

Hi Jerome,

I have installed Hikashop Business v2.1.3.

As far as I can find out, occurs the problem in the backend view "product/selectcategory. php

On line 59 the field "category_name" is used, but this field is not a part of table "hikashop_product_category".

&lt;?php echo JHTML::_('grid.sort', JText::_('HIKA_NAME'), '**a.category\_name**', $this-&gt;pageInfo-&gt;filter-&gt;order-&gt;dir,$this-&gt;pageInfo-&gt;filter-&gt;order-&gt;value ); ?&gt;

When i sort on the Name column, the folowing error occurs:

1054 Unknown column 'a.category_name' in 'order clause' SQL=SELECT a.ordering, b.* FROM spa_hikashop_product_category AS a LEFT JOIN spa_hikashop_product AS b ON a.product_id=b.product_id WHERE a.category_id=2 AND b.product_type = 'main' ORDER BY a.category_name asc LIMIT 0, 20

Regards,

René

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzMtYnVnLXJlcG9ydC83Nzk1NC1teXNxbC1jb21tYW5kLWVycm9yLW9uLXByb2R1Y3QtbGlzdC1pbi1hZG1pbj90bXBsPW1hcmtkb3du) or [Create an account](/register) to join the conversation.

- **[Jerome](/forum/user/80-jerome "View Jerome's Profile")**
- [![Jerome's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar80.png)](/forum/user/80-jerome "View Jerome's Profile")
- [ Offline](/forum/user/80-jerome)
- HikaShop core developer

Less More

- Posts: 26394
- Thank you received: 4078
-
- [](http://obsi.dev)
-

13 years 4 months ago [\#107793](#107793) by [Jerome](/forum/user/80-jerome "View Jerome's Profile")  Replied by *[Jerome](/forum/user/80-jerome "View Jerome's Profile")* on topic *[MySQL command error on product list in admin](/forum/3-bug-report/77954-mysql-command-error-on-product-list-in-admin#107793 "whenever I try to go here:  . . . /administrator/index.php?option=com&#95;hikashop&amp;ctrl=product  I get this:  An error has occurred. 500 SQL=SELECT a.ordering, b.&#42; FROM hikashop&#95;product&#95;category AS a LEFT JOIN hikashop&#95;product AS b ON a.product&#95;id=b.product&#95;id WHERE a.category&#95;id=2 AND b.product&#95;type = 'main' ORDER BY a.category&#95;name asc LIMIT 0, 20 Error in query: Unknown column 'a.category&#95;name' in 'order clause'")*

Hi,

Please logout and clean your cookies.
I don't know which view broke your session but the problem does not come from the "product &#124; selectcategory".
I checked a lot of view but I can't find which one have overwrite the filter value for the product listing.
So the best is too clean your cookies so the sortering filters will be reset.

We will add new checks in future release is order to remove wrong sorting (and not generate a sql error).

Regards,

---

Jerome - Obsidev.com
HikaMarket &amp; HikaSerial developer / HikaShop core dev team.

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzMtYnVnLXJlcG9ydC83Nzk1NC1teXNxbC1jb21tYW5kLWVycm9yLW9uLXByb2R1Y3QtbGlzdC1pbi1hZG1pbj90bXBsPW1hcmtkb3du) or [Create an account](/register) to join the conversation.

- **[Rebo2k](/forum/user/19354-rebo2k "View Rebo2k's Profile")**
- [![Rebo2k's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/19354-rebo2k "View Rebo2k's Profile")
- [ Offline](/forum/user/19354-rebo2k)

Less More

- Posts: 22
- Thank you received: 0
-
-
-
-

13 years 4 months ago -  13 years 4 months ago [\#108280](#108280) by [Rebo2k](/forum/user/19354-rebo2k "View Rebo2k's Profile")  Replied by *[Rebo2k](/forum/user/19354-rebo2k "View Rebo2k's Profile")* on topic *[MySQL command error on product list in admin](/forum/3-bug-report/77954-mysql-command-error-on-product-list-in-admin#108280 "whenever I try to go here:  . . . /administrator/index.php?option=com&#95;hikashop&amp;ctrl=product  I get this:  An error has occurred. 500 SQL=SELECT a.ordering, b.&#42; FROM hikashop&#95;product&#95;category AS a LEFT JOIN hikashop&#95;product AS b ON a.product&#95;id=b.product&#95;id WHERE a.category&#95;id=2 AND b.product&#95;type = 'main' ORDER BY a.category&#95;name asc LIMIT 0, 20 Error in query: Unknown column 'a.category&#95;name' in 'order clause'")*

Hi Jerome,

I cleaned my cookies after I was logged out, and try it again.

As I expected, it didn't solve the problem.

For so far as I can see, is the real problem a wrong column name in the underlying query statement.

As you can see in the attached error picture, there is no field with the name "category_name" in the table "hikashop_product_category".

The only conclusion I can draw, is that there is an typo in the query statement.

Regards,

René

- [ ![Category&#95;picker&#95;sort&#95;on&#95;name.jpg](/forum/attachment/10525) ](/forum/attachment/10525 "...rt&#95;on&#95;name.jpg") [ ](/forum/attachment/10525?download=1 "...rt&#95;on&#95;name.jpg")
- [ ![Category&#95;picker&#95;sort&#95;on&#95;name&#95;error&#95;2013-06-09.jpg](/forum/attachment/10527) ](/forum/attachment/10527 "...2013-06-09.jpg") [ ](/forum/attachment/10527?download=1 "...2013-06-09.jpg")

Last edit: 13 years 4 months ago by [Rebo2k](/forum/user/19354-rebo2k "View Rebo2k's Profile").

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzMtYnVnLXJlcG9ydC83Nzk1NC1teXNxbC1jb21tYW5kLWVycm9yLW9uLXByb2R1Y3QtbGlzdC1pbi1hZG1pbj90bXBsPW1hcmtkb3du) or [Create an account](/register) to join the conversation.

- **[nicolas](/forum/user/63-nicolas "View nicolas's Profile")**
- [![nicolas's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar63.png?1793428657)](/forum/user/63-nicolas "View nicolas's Profile")
- [ Offline](/forum/user/63-nicolas)

Less More

- Posts: 86322
- Thank you received: 14281
-
-

13 years 4 months ago [\#108291](#108291) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[MySQL command error on product list in admin](/forum/3-bug-report/77954-mysql-command-error-on-product-list-in-admin#108291 "whenever I try to go here:  . . . /administrator/index.php?option=com&#95;hikashop&amp;ctrl=product  I get this:  An error has occurred. 500 SQL=SELECT a.ordering, b.&#42; FROM hikashop&#95;product&#95;category AS a LEFT JOIN hikashop&#95;product AS b ON a.product&#95;id=b.product&#95;id WHERE a.category&#95;id=2 AND b.product&#95;type = 'main' ORDER BY a.category&#95;name asc LIMIT 0, 20 Error in query: Unknown column 'a.category&#95;name' in 'order clause'")*

Hi,

It's not that simple. The order by of the query is generated dynamically based on the title that is selected for the ordering on the listing. By default the products listing is ordered by the "ordering" column.
So if you logout and login again, that should wipe out your user session and thus the title selection for the ordering and it should go back to the default "ordering" title of the products listing.

If you want to look at the code, you can see that in administrator/components/com_hikashop/views/view.html.php, you have the line:
$pageInfo-&gt;filter-&gt;order-&gt;value = $app-&gt;getUserStateFromRequest( $this-&gt;paramBase.".filter_order", 'filter_order', 'a.ordering','cmd' );

which loads the ordering title from the user selection/user session. And as you can see, the default column is a.ordering and not category_name.

So I can't see how that's possible that you have the category_name title used for the ordering of the listing after a user session wipe out.

At least, we are not able to reproduce the problem on our end and no one else besides you too reported the issue so I can only think of something that you have in common on your website which other users don't have. If there was such issue by default in HikaShop which would have had 100s of people reporting the issue since last release.

Can you provide a backend access to your website so that we can see that error as otherwise we won't be able to move forward on the issue ?

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzMtYnVnLXJlcG9ydC83Nzk1NC1teXNxbC1jb21tYW5kLWVycm9yLW9uLXByb2R1Y3QtbGlzdC1pbi1hZG1pbj90bXBsPW1hcmtkb3du) or [Create an account](/register) to join the conversation.

Board Categories HikaShop Install &amp; Update Product &amp; Category Display Content Creation Sales and Orders Orders management Reports &amp; Statistics Customers Checkout Payment Methods Shipping Methods Import &amp; Export (CSV, XLS…) Specific Features Affilation Taxes Wishlist Vote Carousel &amp; Slider Mass Actions Filters &amp; Search Discount &amp; Coupon Feature Request Integrations Showcase General Talk about HikaShop Development HikaShop 3.0 Beta Translation Commercial Jobs HikaShop Components HikaMarket Market: Feature requests Market: How to? Market: Bug Report HikaSerial General talk about HikaSerial Serial: Bug Report Serial: How to? Support en Français de HikaSerial (French Support) HikaSubscription HikaAuction Auction: Feature requests Auction: How to? Auction: Bug report Hikashop around the world Support en Français (French Support) Russian FAQ. Курс выживания с Hikashop. Частые вопросы и о Расширения Hikashop Наши сайты на Hikashop 日本語版サポート(Japanese Support) Thai German Archives Bug Report How to?

[](/forum/topics/feed/mode-topics?format=feed&type=rss)

Time to create page: 0.122 seconds

[Powered by](/forum/credits) [Kunena Forum](https://www.kunena.org)
