This topic is locked
[SOLVED]

 Limit not working in 9.7 ?

5/19/2017 9:43:04 AM
PHPRunner General questions
mbintex author

Have this query:

SELECT

`s_order_details`.`id`,

`s_order_details`.`articleID`,

`s_order_details`.`articleordernumber`,

`s_order_details`.`name`,

`s_order_details`.`price`,

SUM(`s_order_details`.`price`) AS `turnover`

FROM `s_order_details`

LEFT OUTER JOIN `s_order` ON `s_order_details`.`orderID` = `s_order`.`id`

GROUP BY `s_order_details`.`articleID`

ORDER BY turnover DESC limit 10


Shows only the Top 10 in Query Preview, but then in phpRunner it finally shows all records.
What´s going on here?

jadachDevClub member 5/19/2017

From my understanding you cannot do select top 10 in query designer within PHPRunner.

You need to build a view in the database with that criteria, then use that view in your project. At least that's how I have had to do it.

John Rotella 5/21/2017



From my understanding you cannot do select top 10 in query designer within PHPRunner.

You need to build a view in the database with that criteria, then use that view in your project. At least that's how I have had to do it.


That is correct. I do a Top 50.

mbintex author 5/22/2017

fiddling around with it I found a quite easy way inside PHPrunner.
Just add



$strOrderBy="ORDER BY turnover DESC limit 10";


or something like this as a
BeforeSQLQuery event and you´re done.

John Rotella 5/22/2017



fiddling around with it I found a quite easy way inside PHPrunner.
Just add



$strOrderBy="ORDER BY turnover DESC limit 10";


or something like this as a
BeforeSQLQuery event and you´re done.



THANK YOU for this.