Radicore Forum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » RADICORE development » Application Development » Adding SUM() data to screen and report (Problems generating SQL and populating nondb field on list2 screen)
Re: Adding SUM() data to screen and report [message #2708 is a reply to message #2707] Fri, 29 April 2011 04:09 Go to previous messageGo to previous message
AJM is currently offline  AJM
Messages: 2361
Registered: April 2006
Location: Surrey, UK
Senior Member
I don't know why you are having so many problems with this as I have used aggregates such as 'COUNT(...) AS count' in several places in my framework. If you take a look in the Dictionary subsystem at the 'List Database' task you will see columns on the right which show the table count and the relationship count. In order to get around the 'group by' problem I have replaced the 'COUNT(...) AS count' with inner selects such as:
$sql_select .= ', (SELECT COUNT(database_id) FROM dict_table
                   WHERE ct_table.database_id=dict_database.database_id) as table_count';
$sql_select .= ', (SELECT COUNT(database_id_snr) FROM dict_relationship
                   WHERE dict_relationship.database_id_snr=dict_database.database_id) as rel_count';


If you want an extra row displayed at the end of the list to show overall totals then you need to check out MySQL's WITH ROLLUP option. This is mentioned in FAQ127.


 
Read Message
Read Message
Read Message
Previous Topic: SUM(price)
Next Topic: new field for file upload transaction
Goto Forum:
  


Current Time: Sat Aug 24 11:20:54 EDT 2024

Total time taken to generate the page: 0.00979 seconds