How to use group_concat in SQL
the GROUP_CONCAT
function is used to concatenate values from multiple rows into a single string, grouped by a specified column. This function is commonly used in scenarios where you want to combine multiple related values into a single result.
The syntax for using GROUP_CONCAT
is as follows:
SELECT ID, GROUP_CONCAT(order_product_item_id) order_product_item_id,order_id
FROM product_schedules
WHERE schedule_date='2023-05-09'
GROUP BY order_id;