Hi,
I am using the below query in Ms-SQL 2005. I want to convert this into Pervasive SQL. This will be appreciated for the proper solution.
Thanks in advance
Regards,
RaaBii
************************************************** *******
with
Salesperson AS(
select distinct codeslsp1 'SP',
case when pctsasplt1<>0 and codeslsp1 = '' then amtbaldueh else (pctsasplt1 * amtbaldueh/100) end 'OS'
from arcus
union
select distinct codeslsp2 'SP',
case when pctsasplt2<>0 and codeslsp2 = '' then amtbaldueh else (pctsasplt2 * amtbaldueh/100) end 'OS'
from arcus
union
select distinct codeslsp3 'SP',
case when pctsasplt3<>0 and codeslsp3 = '' then amtbaldueh else (pctsasplt3 * amtbaldueh/100) end 'OS'
from arcus
union
select distinct codeslsp4 'SP',
case when pctsasplt4<>0 and codeslsp4 = '' then amtbaldueh else (pctsasplt4 * amtbaldueh/100) end 'OS'
from arcus
union
select distinct codeslsp5 'SP',
case when pctsasplt5<>0 and codeslsp5 = '' then amtbaldueh else (pctsasplt5 * amtbaldueh/100) end 'OS'
from arcus)
select SP = (case when SP = '' then 'Others' else SP end), sum(OS) 'OS'
from Salesperson
group by SP
************************************************** *******