错误号:1055
SELECT列表的表达式#1不在GROUP BY子句中,并且包含未聚合的列'db_name.tbl_gigs.id',该列在功能上不依赖于GROUP BY子句中的列;这与sql_mode = only_full_group_by
不兼容
SELECT SQL_CALC_FOUND_ROWS
tbl_gigs.*,
tbl_users.first_name, tbl_users.service_name, tbl_users.last_name, tbl_users.image,
tbl_event_type.name_french as name, tbl_event_type.name_french, tbl_event.approval_status as event_appstatus, tbl_event.event_no
FROM (`tbl_gigs`)
LEFT JOIN `tbl_event_type` ON `tbl_event_type`.`id` = `tbl_gigs`.`event_type`
LEFT JOIN `tbl_users` ON `tbl_users`.`id` = `tbl_gigs`.`invites`
LEFT JOIN `tbl_event` ON `tbl_event`.`id` = `tbl_gigs`.`event_id`
WHERE `tbl_gigs`.`status` = '1' AND tbl_gigs.user_id = '261' AND tbl_gigs.event_id != '0'
GROUP BY `tbl_gigs`.`event_id`
ORDER BY `tbl_gigs`.`id` desc
LIMIT 10
答案 0 :(得分:2)
我已经在查询下方使用了用户
SET GLOBAL sql_mode=(SELECT REPLACE(@@sql_mode,'ONLY_FULL_GROUP_BY',''))