จะ group หลาย ๆ record เป็น record เดียวทำยังไงครับ
Code (PHP)
SELECT
tbl_material.title,
tbl_logs.`start`,
tbl_logs.Id,
tbl_std.std_id
FROM
tbl_logs
INNER JOIN tbl_material ON tbl_logs.Id = tbl_material.logs_id
INNER JOIN tbl_std ON tbl_logs.Id = tbl_std.logs_id
WHERE YEAR(start) = 2015 AND MONTH(start) = 08 AND DAY(start) = 20
ORDER BY title
SELECT
tbl_material.title,
tbl_logs.`start`,
tbl_logs.Id,
GROUP_CONCAT(tbl_std.std_id SEPARATOR ', ') As g
FROM
tbl_logs
INNER JOIN tbl_material ON tbl_logs.Id = tbl_material.logs_id
INNER JOIN tbl_std ON tbl_logs.Id = tbl_std.logs_id
WHERE YEAR(start) = 2015 AND MONTH(start) = 08 AND DAY(start) = 20
GROUP BY Id
ORDER BY title