Front End - Delphi
Backend - Progress Database
ODBC - SQL92
I need to find no of items shipped each day.
So i am using
select count(*), tr_effdate
from tr_hist, where tr_type = "ISS-SO"
and tr_effdate >= 06/01/06
and tr_effdate <= 06/30/06
group by tr_effdate.
This gives me
Count Date
5 06/01/06
5 06/02/06
5 06/03/06
5 06/04/06
.
.
But i need a result like below
5 06/01/06
10 06/02/06
15 06/02/06
(the count should keep on adding with the previous day counts)
Tried the below syntax in Progress Explorer, but i get syntax error.
SELECT t1.tr_effdate, COUNT(t1.tr_effdate) AS DayCount, (SELECT COUNT(*) FROM tr_hist t2
WHERE t2.tr_effdate BETWEEN '1 Jun 2006' AND t1.tr_effdate) AS MonthToDate
FROM tr_hist t1
GROUP BY t1.tr_effdate
ORDER BY t1.tr_effdate
it works for
SELECT t1.tr_effdate, COUNT(t1.tr_effdate) AS DayCount FROM pub.tr_hist t1
GROUP BY t1.tr_effdate
ORDER BY t1.tr_effdate
but if i add the (SELECT COUNT(*) FROM pub.tr_hist t2
WHERE t2.tr_effdate BETWEEN '1 Jun 2006' AND t1.tr_effdate) AS MonthToDate
it give syntax error.
Please help me with the query?
Thanks
Backend - Progress Database
ODBC - SQL92
I need to find no of items shipped each day.
So i am using
select count(*), tr_effdate
from tr_hist, where tr_type = "ISS-SO"
and tr_effdate >= 06/01/06
and tr_effdate <= 06/30/06
group by tr_effdate.
This gives me
Count Date
5 06/01/06
5 06/02/06
5 06/03/06
5 06/04/06
.
.
But i need a result like below
5 06/01/06
10 06/02/06
15 06/02/06
(the count should keep on adding with the previous day counts)
Tried the below syntax in Progress Explorer, but i get syntax error.
SELECT t1.tr_effdate, COUNT(t1.tr_effdate) AS DayCount, (SELECT COUNT(*) FROM tr_hist t2
WHERE t2.tr_effdate BETWEEN '1 Jun 2006' AND t1.tr_effdate) AS MonthToDate
FROM tr_hist t1
GROUP BY t1.tr_effdate
ORDER BY t1.tr_effdate
it works for
SELECT t1.tr_effdate, COUNT(t1.tr_effdate) AS DayCount FROM pub.tr_hist t1
GROUP BY t1.tr_effdate
ORDER BY t1.tr_effdate
but if i add the (SELECT COUNT(*) FROM pub.tr_hist t2
WHERE t2.tr_effdate BETWEEN '1 Jun 2006' AND t1.tr_effdate) AS MonthToDate
it give syntax error.
Please help me with the query?
Thanks