item_id | type |
---|---|
1 | 1 |
2 | 2 |
3 | 2 |
4 | 1 |
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'