dw数据源求解
sql涉及的表及其结构:
表一:displace
(displace_code rebound_date rebound_destination product_type)
1010 2003-03-01 贵州 商用空调
1012 2003-05-21 黄岛 商用空调
表二:displace_detail
(displace_code form_code macID quantiti_detail price_detail amount_detail)
1010 000146 100 1 1200.00 1200.00
1012 000147 100 2 1200.00 2400.00
1012 000147 102 1 3400.00 3400.00
表三:displace_product
(displace_code order_code macID quantiti_product price_product amount_product)
1010 20030503 100 2 1200.00 2400.00
1010 20030503 103 1 900.00 900.00
1012 20030101 102 3 3400.00 10200.00
表四:mechanism_price (macID macName macPrice)
100 KF_R 1200.00
101 KF_D 1000.00
102 RD_D 3400.00
103 KF_G 900.00
表五:gongmao (gm_code gm_name)
SYKT001 北京工贸
SYKT002 上海工贸
说明:由以上数据得出以下表格式样的报表,其中,左边和右边的记录不一定相等,获得那个工贸的报表人工控制。这样SQL语句怎么写?
北京工贸 不良品返厂置换表
返厂日期:2003-03-01 产品类型:商用空调 返厂目的地:贵州 置换表号:1010
不良品返厂 正品置换
机型 数量 机型供价 合计金额 机型 数量 机型供价 合计金额
KF_R 1 1200.00 1200.00 KF_R 2 1200.00 2400.00
KF_G 1 900.00 900
拜托,谢谢!