|
The statement is like this
select right(customer,len(customer)-charindex('-',customer)) as customer, quantity, date
FROM
(
select distinct customers, null as quantity, date from tb_cat
union
select customer+'-'+product number, sum (quantity), date from tb_cat group by customer, product number
) T
order by customer |
|