Page 1 of 1

SQL query with GROUP BY doesn't work, Why?

Posted: Mon Aug 25, 2014 9:32 pm
by guscastro
I have this code on MYSQL

Code: Select all

SELECT `line`, sum(`value`) FROM `la_quotes` GROUP BY `line` 
Running the query direct on the database, brings the actual result like this..
Line1 986897
Line2 17329271
Line3 3934390
Line4 202100
Line5 3689419

Running the code on a report on nuBuilder do not get SUM,
I wonder what am i missing to amke this totals work on nubuilder?
Line1 22530
Line2 105279
Line3 64080
Line5 101050
Line6 97688

I am running the report with a button with and "onclick" Event nuPrintPDF('01_quotes_by_line');

Please help.

I also notice that if I place the code on the SQL on a form, it doesn't bring the total per `line`
Is it that GROUP BY is invalidated by nubyuilder, If so, what is the turn around.
I would appreciate answer with example.

Code: Select all

SELECT  `line`, sum(`value`) FROM `la_quotes` GROUP BY `line`
Thank you
Image

Re: SQL query with GROUP BY doesn't work, Why?

Posted: Wed Aug 27, 2014 6:16 am
by admin
guscastro,

Firstly and most important.. http://forums.nubuilder.cloud/viewtopic.php?f=13&t=8515

Secondly to display sum(value) as a column in the browse you would need to define it (in the Browse Tab)

It won't work anyway because of the First reason.

Steven