This topic is locked
[SOLVED]

 invalid use of Group function

10/24/2014 6:50:36 AM
PHPRunner General questions
S
Sergej author

Hi, All

am getting this error when trying to use search on list page...


Advanced search works fine...

SQL QUERY is as follows

SELECT

RadniNalog.ID,

RadniNalog.BrojRadnogNaloga,

RadniNalog.VodjaTima,

RadniNalog.Klijent,

RadniNalog.Iznos,

RadniNalog.VrstaUsluge,

RadniNalog.Velicina,

RadniNalog.Kotacija,

RadniNalog.OdJavnogInteresa,

RadniSati.Djelatnik,

SUM((Time_To_Sec(RadniSati.Do)-Time_To_Sec(RadniSati.Od)-Time_To_Sec(RadniSati.Pauza))) AS Odradjeno,

(RadniNalog.PredvidjeniSati1) AS Ukupno,

(RadniNalog.PredvidjeniSati
3600)-SUM((Time_To_Sec(RadniSati.Do)-Time_To_Sec(RadniSati.Od)-Time_To_Sec(RadniSati.Pauza))) AS Preostalo

FROM RadniNalog

INNER JOIN RadniSati ON RadniNalog.BrojRadnogNaloga = RadniSati.Nalog

GROUP BY RadniNalog.BrojRadnogNaloga, RadniSati.Djelatnik
What's wrong with Grouping...

PHP RUNNER is 8.0 Latest build

Please help...

Best,

Sergej

Sergey Kornilov admin 10/24/2014

Create a view in your database on the top of your SQL query and use this view as a datasource in PHPRunner. This will solve the issue.

S
Sergej author 10/25/2014



Create a view in your database on the top of your SQL query and use this view as a datasource in PHPRunner. This will solve the issue.



The first table in Query is view actually - but the second one is joined as a table - should i create the second table as a view also? is it possible to join two views?

thnx

A
Anapolis 10/25/2014



The first table in Query is view actually - but the second one is joined as a table - should i create the second table as a view also? is it possible to join two views?

thnx



Not having your tables I cannot check this but if this is a specific lookup that is used over and over have you tried using the CREATE TABLE statement?
CREATE TABLE Lookupjoin

SELECT

RadniNalog.ID,

RadniNalog.BrojRadnogNaloga,

RadniNalog.VodjaTima,

RadniNalog.Klijent,

RadniNalog.Iznos,

RadniNalog.VrstaUsluge,

RadniNalog.Velicina,

RadniNalog.Kotacija,

RadniNalog.OdJavnogInteresa,

RadniSati.Djelatnik,

SUM((Time_To_Sec(RadniSati.Do)-Time_To_Sec(RadniSati.Od)-Time_To_Sec(RadniSati.Pauza))) AS Odradjeno,

(RadniNalog.PredvidjeniSati1) AS Ukupno,

(RadniNalog.PredvidjeniSati
3600)-SUM((Time_To_Sec(RadniSati.Do)-Time_To_Sec(RadniSati.Od)-Time_To_Sec(RadniSati.Pauza))) AS Preostalo

FROM RadniNalog

INNER JOIN RadniSati ON RadniNalog.BrojRadnogNaloga = RadniSati.Nalog

GROUP BY RadniNalog.BrojRadnogNaloga, RadniSati.Djelatnik
If the results change because the table values change frequently then perhaps you could put the Create Table query into an Event code that precedes the loading of the List page where you need to have the Search values already assembled.
If the Lookup here changes dynamically then you could put a Drop Table by name before the Create Tablestatement. Assuming your host can whip out this lookup into a table in hundredths of a second then it will always be the latest possible lookup using the same table name over and over.

Sergey Kornilov admin 10/26/2014

In your MySQL views you can refer to other views, join them etc. As a rule of thumb - if your SQL query is too complicated for PHPRunner to parse use view in MySQL.

S
Sergej author 10/27/2014

thank you!