this query only print all the data from table i want total quantity and total amount of daily sale in same grid when ever date changes
You may add the date filter to Visakh's query:
SELECT SLHD.VOUCH_DATE,SUM(SLTXN.CALC_NET_AMT) AS AMT,SUM(SLTXN.TOT_QTY) AS QTY
FROM SL_HEAD20132014 AS SLHD,ACCOUNTS AS ACT,SL_TXN20132014 AS SLTXN
WHERE SLHD.ACT_CODE=ACT.ACT_CODE AND SLTXN.VOUCH_CODE=SLHD.VOUCH_CODE
and SLHD.VOUCH_DATE = @yourdate --passed from the front end application
GROUP BY SLHD.VOUCH_DATE
WITH CUBE
ORDER BY SLHD.VOUCH_DATE
Having said, each time when you select the date, you query the table would be expensive method. May be you can filter the date within your dataset already populated if you have entire data in the dataset.
No comments:
Post a Comment