<./>.dev./hood

select
table_order_detail.*
,table_order_detail.use_date as detail_use_date
,table_order_detail.cancel_date as detail_cancel_date
,table_order_detail.status as order_detail_status
,table_order_detail.sale_price as sale_price
,table_order.*
,table_member.mem_code 
,table_member.mem_name
,table_channel.channel_code
,table_channel.channel_name
-- ,table_product_detail.deal_code
-- ,table_product_detail.option_name
-- ,table_product_detail.pos_id
-- ,table_product_detail.product_detail_code
,table_provider.prov_code
,table_provider.prov_name
,table_pos.pos_id
,table_pos.mem_code
,table_pos.pos_name
from
table_order_detail
inner join table_order on table_order_detail.order_num = table_order.order_num
inner join table_member on table_order.mem_code = table_member.mem_code
inner join table_channel on table_order.channel_code = table_channel.channel_code
inner join table_product on table_order.product_code = table_product.product_code
-- inner join table_product_detail on table_order_detail.option_name = table_product_detail.option_name
inner join table_product_detail on table_order_detail.product_detail_code = table_product_detail.product_detail_code
inner join table_provider on table_product.prov_code = table_provider.prov_code
left join table_pos on table_order_detail.pos_id = table_pos.pos_id
where 1 = 1 order by table_order_detail.order_num limit 100;