Last active
July 31, 2020 11:48
-
-
Save atapatel/6bbf065ebbdac5623ac756798395861b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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'
)
OR
concat(disp_id,payment_slug) in (
SELECT concat(disp_id,IF(payment_method='both','card')) from dispensaries where payment_method='both'
)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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'
)