Skip to content

Instantly share code, notes, and snippets.

@steverobbins
Last active November 18, 2015 23:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save steverobbins/75ba783cef2a797584eb to your computer and use it in GitHub Desktop.
Save steverobbins/75ba783cef2a797584eb to your computer and use it in GitHub Desktop.
select p.id, p.sku, p.upc, json_get(p.custom_data, 'pricing_guide') pricing_guide, p.long_name
from products p
inner join amazonproducts ap on ap.product_id = p.id
where
(
json_get(p.custom_data, 'life_cycle', 0) != 'Pre-Release'
or (
json_get(p.custom_data, 'life_cycle', 0) != 'Active'
and json_get(p.custom_data, 'product_group') != 'Machines'
)
)
and ap.buybox_status = 3000
order by p.id desc;
select p.id, p.sku, p.upc, json_get(p.custom_data, 'pricing_guide') pricing_guide
from products p
inner join amazonproducts ap on ap.product_id = p.id
where
json_get(p.custom_data, 'life_cycle', 0) = 'Active'
and json_get(p.custom_data, 'product_group') = 'Machines'
and ap.buybox_status = 3000
order by p.id desc;
update products p
inner join amazonproducts ap on ap.product_id = p.id
set p.custom_data = replace(replace(p.custom_data, 'low_price', 'lowestless5'), 'map_price', 'lowestless5')
where
(
json_get(p.custom_data, 'life_cycle', 0) != 'Pre-Release'
or (
json_get(p.custom_data, 'life_cycle', 0) != 'Active'
and json_get(p.custom_data, 'product_group') != 'Machines'
)
)
and ap.buybox_status = 3000
;
update products p
inner join amazonproducts ap on ap.product_id = p.id
set p.custom_data = replace(replace(p.custom_data, 'low_price', 'match'), 'map_price', 'match')
where
json_get(p.custom_data, 'life_cycle', 0) = 'Active'
and json_get(p.custom_data, 'product_group') = 'Machines'
and ap.buybox_status = 3000
;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment