Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- SELECT DISTINCT
- a.tyear,
- a.tperiod,
- b.country_group,
- b.tipe_product
- FROM
- (SELECT DISTINCT YEAR
- ( a.Bill_date ) as 'tyear',
- MONTH ( a.bill_date ) as 'tperiod'
- FROM
- billing_document_header_data as a
- union
- select distinct ts.`year`, ts.period from target_sales as ts
- where CONCAT(ts.`Year`,ts.period) not in
- (
- SELECT DISTINCT
- CONCAT(YEAR( bl.Bill_date ),MONTH ( bl.bill_date )) as 'typ'
- FROM
- billing_document_header_data as bl))
- AS a
- join
- (select DISTINCT c.country_group, d.tipe_product from customer_mapping as c
- left join (select distinct Country_Group_Target_Export, tipe_product
- from table_target_area) as d
- on c.country_group=d.Country_Group_Target_Export) as b;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement