CodeCharge Studio
search Register Login  

Web Reports

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

YesSoftware Forums -> CodeCharge Studio -> PHP

 Problem with simple "group by" in sql query

Print topic Send  topic

Author Message
headhunter


Posts: 130
Posted: 12/22/2012, 8:23 AM

Hello,

Can someone explain me why CCS does give me strange results on a "group by"?
Explanation:

I have a user table with about 86.000 records. When I build a simple grid and do a group by on the user_id it gives me about 35 records and a CCSNotCounted on the counted records label on top of the grid.

When I run the same query in my sql management studio it is no problem to do that.

Normally I have some joins on the grid, one join with a one to many relationship. I came to this simplification of the query/grid because the group by did not what I expected with the joins, but it seems that even on a simple table without joins it doesn't even work...
the user_id field is auto increment and primary key.

The simple query:

SELECT user_id, first_name, e_mail, last_name
FROM cms_users
GROUP BY user_id

Thanks in advance!

Bart Verstricht
View profile  Send private message
Lucius

Posts: 220
Posted: 01/09/2013, 6:39 AM

Hi,

This is connected to how the count method is implemented in the CCS. In queries that use Group by you most likely need to override the CountSQL property of DataSource of your Grid.

Put there your own query, that will count it correctly. Just make sure you will do it on Before Execute Select event of the grid.
View profile  Send private message

Add new topic Subscribe to topic   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

PHP Reports

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.