mohammed shamsheer

mohammed shamsheer

  • NA
  • 394
  • 144.4k

sql select statement error

Mar 11 2015 8:11 AM
SELECT Date,MIN(VchNo) +'-'+MAX(VchNo) as VchNos--, Form,[VAT %],SUM(TaxableValue) as TaxableValue,SUM(TotalVAT) as TotalVAT,SUM(Total) as Total    
FROM (
SELECT   CONVERT(varchar(10), InvTransactionMaster.TransactionDate, 105) AS Date,  
                      InvTransactionMaster.VoucherPrefix + ' ' + CAST(InvTransactionMaster.VoucherNumber AS varchar) AS VchNo,   
                      InvTransactionMaster.VoucherType + ' ' + InvTransactionMaster.VoucherForm AS Form, InvTransactionDetails.VatPercentage AS [VAT %],   
                      SUM(InvTransactionDetails.NetValue) AS [TaxableValue], SUM(InvTransactionDetails.TotalVatAmount) AS [TotalVAT],   
                      SUM(InvTransactionDetails.NetValue + InvTransactionDetails.TotalVatAmount) AS Total  
FROM         InvTransactionDetails INNER JOIN  
                      InvTransactionMaster ON InvTransactionDetails.InvTransactionMasterID = InvTransactionMaster.InvTransactionMasterID  
WHERE  InvTransactionMaster.IsActive =1   
   AND InvTransactionMaster.VoucherType ='SI'   
  AND InvTransactionMaster.BranchID=1--@BranchID  
   AND InvTransactionDetails.BranchID=1--@BranchID  
   AND InvTransactionMaster.TransactionDate BETWEEN '2015-02-06' and '2015-02-07'--@FromDate AND @ToDate  
   --AND (@VATPerc=-1 OR InvTransactionDetails.VatPercentage =@VATPerc)  
                        
GROUP BY InvTransactionMaster.TransactionDate,   
                      InvTransactionMaster.VoucherPrefix, InvTransactionMaster.VoucherNumber, InvTransactionMaster.VoucherType, InvTransactionMaster.VoucherForm,   
                      InvTransactionDetails.VatPercentage  
                       ) AAA GROUP BY AAA.Date,AAA.Form,AAA.[VAT %] ORDER BY AAA.Date  


-------------------


this is my query ....every thing fine but for a particular date it showing some error ...any body have any idea....i give the all the details....

Answers (1)