cancel
Showing results for 
Search instead for 
Did you mean: 

order by clause was not working for below query can anybody help me why its not working

Former Member
0 Kudos

Below Query

select {product.pk} , count({product.pk}) from {product},{catalogversion},{WishList2Entry},{wishlist2} where {catalogversion.pk}={product.catalogversion} and {WishList2Entry.product}={product.pk} and {catalogversion.version}='Online' and {WishList2Entry.wishlist}={wishlist2.pk} GROUP BY {product.pk} order by count({product.pk}) asc

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Hello ,

I tested on OOTB 5.5.1.0 with the query on hAC, it ran successfully, no data return.

So I simplified the query to get any return values:

select {product.pk} , count({product.pk}) from {product} GROUP BY {product.pk} order by count({product.pk}) asc

The query ran successfully, and data return:

Please let me know what exactly you meant by the query not working. Did you get any exceptions? And please try the query on hAC.

Cheers,

Mingming

Former Member
0 Kudos

HI

Query working for , but order clause not working which means when I applied ASC or DESC it will not sorting please fine below result for the query, in the above query I was applied ASC but not displaying ascending order

Thanks Nagendra

bikrambsinha
Participant
0 Kudos

Normally order by doesn't work with Group By. The query should have Group By {product.pk} having count(product.pk).