-
-
Save atapatel/6bbf065ebbdac5623ac756798395861b to your computer and use it in GitHub Desktop.
select * from ((SELECT disp_id, | |
'both', | |
'All', | |
'INACTIVE', | |
now() as created_at, | |
now() as updated_at, | |
NULL | |
FROM dispensaries | |
UNION All | |
SELECT disp_id, | |
'cod', | |
'Cash On Delivery', | |
'INACTIVE', | |
now() as created_at, | |
now() as updated_at, | |
NULL | |
FROM dispensaries | |
UNION ALL | |
SELECT disp_id, | |
'card', | |
'Card On Delivery', | |
'INACTIVE', | |
now() as created_at, | |
now() as updated_at, | |
NULL | |
FROM dispensaries | |
))as x order by x.disp_id; |
update disp_payment_methods set status='ACTIVE' where concat(disp_id,payment_slug) in (
SELECT concat(disp_id,payment_method) from dispensaries
)
OR
concat(disp_id,payment_slug) in (
SELECT concat(disp_id,IF(payment_method='both','cod')) from dispensaries where payment_method='both'
)
concat(disp_id,payment_slug) in (
SELECT concat(disp_id,IF(payment_method='both','card')) from dispensaries where payment_method='both'
)
update disp_payment_methods set status='ACTIVE' where concat(disp_id,payment_slug) in (
SELECT concat(disp_id,payment_method) from dispensaries
)
OR
concat(disp_id,payment_slug) in (
SELECT concat(disp_id,IF(payment_method='both','cod')) from dispensaries where payment_method='both'
)
OR
concat(disp_id,payment_slug) in (
SELECT concat(disp_id,IF(payment_method='both','card')) from dispensaries where payment_method='both'
)
update disp_payment_methods set status='ACTIVE' where concat(disp_id,payment_slug) in (SELECT concat(disp_id,payment_method) from dispensaries)