sql - mysql | Getting Database error, Invalid Use of Group Function -
i using ignited datatables. working fine except filter. when searching in it, error
invalid utilize of grouping function
i getting query in error result.
select `f`.`formid`, `f`.`formname`, `f`.`formcipath`, min(g.ismenulink) ismenulink, group_concat(distinct g.groupid order g.groupid) groupids (`sys_forms` f) inner bring together `sys_forms_in_groups` g on `g`.`formid` = `f`.`formid` `g`.`groupid` in ('1', '1') , (upper(f.formname) '%da%' or upper(f.formcipath) '%da%' or upper(min(g.ismenulink)) '%da%' ) grouping `f`.`formid` limit 25
what wrong query.??
the problem have aggregation functions in where
clause:
select `f`.`formid`, `f`.`formname`, `f`.`formcipath`, min(g.ismenulink) ismenulink, group_concat(distinct g.groupid order g.groupid) groupids (`sys_forms` f) inner bring together `sys_forms_in_groups` g on `g`.`formid` = `f`.`formid` `g`.`groupid` in ('1', '1') , (upper(f.formname) '%da%' or upper(f.formcipath) '%da%' or upper(min(g.ismenulink)) '%da%' --------------^ ) grouping `f`.`formid` limit 25;
you can remove function, think:
where `g`.`groupid` in ('1', '1') , (upper(f.formname) '%da%' or upper(f.formcipath) '%da%' or upper(g.ismenulink) '%da%' )
or move having
clause.
select `f`.`formid`, `f`.`formname`, `f`.`formcipath`, min(g.ismenulink) ismenulink, group_concat(distinct g.groupid order g.groupid) groupids (`sys_forms` f) inner bring together `sys_forms_in_groups` g on `g`.`formid` = `f`.`formid` `g`.`groupid` in ('1', '1') , (upper(f.formname) '%da%' or upper(f.formcipath) '%da%' ) grouping `f`.`formid` having upper(min(g.ismenulink)) '%da%' limit 25;
mysql sql
No comments:
Post a Comment