Skip to content

Instantly share code, notes, and snippets.

@worstn8mare
Created October 7, 2019 05:17
Show Gist options
  • Save worstn8mare/6ccb58da52d8ee3dbaa3289c41e754f9 to your computer and use it in GitHub Desktop.
Save worstn8mare/6ccb58da52d8ee3dbaa3289c41e754f9 to your computer and use it in GitHub Desktop.
test.items
SELECT
'' as code,
'' as sku,
a.status, a.generic, a.brand, a.make, a.model, a.color, a.size_dim, a.gauge_thick, a.description,
CASE
WHEN a.type = "Serialized" then 3
WHEN a.type = "Inventoriable" then 2
END as inventory_types_id,
CASE
WHEN a.uom = "pcs" THEN 1
WHEN a.uom = "rol" THEN 4
END as uom_id,
a.category,
b.category_id as category_id,
b.sub_category_id as subcategory_id,
a.re_order as reorder_lvl,
a.unit_cost as item_cost,
a.unit_cost as ave_cost,
a.unit_cost as ave_value,
a.min,
a.std,
a.max,
NOW() as created_at,
NOW() as updated_at
from items as a
LEFT JOIN category as b on a.category = b.orig_name
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment