SLQ How to make a selection of values from one column to each separately?
I have a script that pulls data from the rl table - reservation_log from the reason field. There are data marriage, cancellation, refund. How do I split this data into separate fields? I know that you can use the CASE, WHEN, THEN structure. But I don’t understand how to write such syntax correctly.
SELECT
rl.reason as reject_reason
FROM
mda.reservation_log as rl
JOIN
mda.store as st ON rl.store_id = st.md_id
join mda.order_item oi on oi.reserve_id=rl.reservation_id
join mda.sku s on s.id=oi.item_id
join mda.product p on p.id=s.product_id
where rl.created_at > '2020-01-01 00:00:00' and oi.created_at < '2020-02-01 23:59:59' and rl.is_successful=0