F
|
fdiazp 4/19/2022 |
If in the relation you check count other option is in sql of the parent put a (select count(*) from child.id = parent.id ) as qchilds |
P
|
ppradhan@live.com author 4/19/2022 |
@fdiazp4, |
K
|
kohle 4/19/2022 |
Hi, you can add the count as field to your master sql : rgs |
P
|
ppradhan@live.com author 4/19/2022 |
@kohle, Fatal error: Uncaught mysqli_sql_exception: In aggregated query without GROUP BY, expression #1 of SELECT list contains nonaggregated column 'softedsr_office_digi.sch_class_sections.id'; this is incompatible with sql_mode=only_full_group_by in D:\WebServer\htdocs\my_digi\connections\MySQLiConnection.php:157 Stack trace: #0 D:\WebServer\htdocs\my_digi\connections\MySQLiConnection.php(157): mysqli_query(Object(mysqli), 'select count()...') #1 D:\WebServer\htdocs\my_digi\connections\Connection.php(635): MySQLiConnection->query('select count()...') #2 D:\WebServer\htdocs\my_digi\classes\datasource\table.php(639): Connection->getFetchedRowsNumber('SELECT\r\n`sch_cl...') #3 D:\WebServer\htdocs\my_digi\classes\listpage.php(2891): DataSourceTable->getCount(Object(DsCommand)) #4 D:\WebServer\htdocs\my_digi\classes\listpage.php(2292): ListPage->calculateRecordCount() #5 D:\WebServer\htdocs\my_digi\sch_class_sections_list.php(153): ListPage->prepareForBuildPage() #6 {main} thrown in D:\WebServer\htdocs\my_digi\connections\MySQLiConnection.php on line 157 |
K
|
kohle 4/19/2022 |
Copy your sql from the query page into mysqladim and check for errors |
P
|
ppradhan@live.com author 4/20/2022 |
@Kohle, thank you. select class_id, class_name, (select count(*) from students where class_id = class.class_id) as number_students did work. But I had to remove WHERE condition from the SQL that I was using to fetch records according to the logged in user from the session: meaing only ONE WHERE clause is accepted. my old code was: |