A
A
Andrew2017-06-17 01:10:49
MySQL
Andrew, 2017-06-17 01:10:49

GROUP BY in MySQL 5.7+, unable to group data?

Hello.
After upgrading to MySQL 5.7, the query below stopped working. I have no idea what needs to be done with it to make it work. I read several articles and forums, but I did not understand anything ...

SELECT calendar.*, subjects.id, subjects.subject_name, teachers_users.full_name AS teach_name 
FROM calendar, subjects, teachers_users, classes 
WHERE calendar.subject = subjects.id 
AND subjects.subject_teacher = teachers_users.id 
AND calendar.class = classes.id 
AND classes.id = '1'  
GROUP BY subjects.id

Answer the question

In order to leave comments, you need to log in

1 answer(s)
L
longclaps, 2017-06-17
@manzadey

Good request, good one. Where are they taught to write?

SELECT
  calendar.*,
  subjects.id,
  subjects.subject_name,
  teachers_users.full_name AS teach_name
FROM calendar
  JOIN subjects ON calendar.subject = subjects.id
  JOIN teachers_users ON subjects.subject_teacher = teachers_users.id
WHERE calendar.class = 1;

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question