Once upon a time I asked a similar question to the one I am about to pose. Essentially a "how to" on condensing two views into one. My SQL skills are rather limited but I did get the following to work:
"Select * from orders" produces the desired results.
I spent several frustrating hours trying to make a single statement out of these two. I know someone with more experience at this will be able to show me where I went wrong.
Steve
Code:
create view helper as select slaenb, sldccd, slcvnb. sla3cd, slrtyp, min(slacdt) as order_date, sum(sldpva) as order_value from domsl100 group by slaenb, sldccd, slcvnb, sla3cd, slrtyp create view orders as select slaenb, sldccd, slcvnb, sla3cd, order_date, order_value, coalesce(c6afvn, bwafvn) as user from helper left outer join mbc6rep on (slaenb = c6aenb and sldccd = c6dccd and slcvnb = c6cvnb) left outer join mbbwcpp on (slaenb = bwaenb and sldccd = bwdccd and slcvnb = bwcvnb) where (slrtyp = 'O' or slrtyp = 'C')
I spent several frustrating hours trying to make a single statement out of these two. I know someone with more experience at this will be able to show me where I went wrong.
Steve
Comment