Hi,

can I execute a Select...If...else Statement with a Pervasive SQL
Vers.8 database? its my first time to use Pervasive... here is my sample code.. pls.. somebody help me modify this..pls..pls..

the if..else..statement wont work...

i badly needed the code..pls somebody..
SELECT
sum(GRNQty) as NEWGT,
if (DOCUMENTTYPE = 4) then sum(InclusivePrice) as Refund,
if (DOCUMENTTYPE = 5) then sum(InclusivePrice) as Adjustments,
sum((QTY*INCLUSIVEPRICE)-REFUND) as Dlysale,
sum((QTY*UNITPRICE)-DISCOUNTAMOUNT) as TOTDISC,
sum(DiscountAmount) as Discount,
sum(TAxAmount) as TAXES,
min(documentnumber) as BEGINV,
max(documentnumber) as ENDINV,
if(ITEMCODE = 'SRVCHARGE') then sum(InclusivePrice) as SERVCHARGE,
if (ITEMCODE = 'OTHRCHARGE') then sum(InclusivePrice) as OTHERCHRGE,
if (TAXTYPE = 0) then sum((Qty*InclusivePrice)-DiscountAmount) as TSL_NX_SAL,
else sum((Qty*InclusivePrice)-DiscountAmount) as TSL_TX_SAL,

if (customercode = 'WALKIN') then sum(QTY*INCLUSIVEPRICE) as CashSales
else sum(QTY*INCLUSIVEPRICE) as ChargeSales
count(*) as TRANCNT,
DATE

From HISTORYLINES WHERE DATE BETWEEN '2007-12-28' AND '2007-12-28' GROUP BY DATE