SELECT
type
,group_concat(item_id separator ',') as item_list
FROM
item_mst
WHERE
start_date < NOW()
AND
(end_date IS NULL OR NOW() < end_date)
GROUP BY
type
^ type ^ item_id ^
| 1 | 1,4 |
| 2 | 2,3 |
===== ログテーブルなどから、特定日付のログのみ抽出 =====
SELECT
*
FROM
log_tbl
WHERE
DATE_FORMAT(reg_date, '%Y%m%d') = '20151102'
SELECT
*
FROM
log_tbl
WHERE
LEFT(reg_date, 10) = '2015-11-02'