Subject | Re: SQL aging report |
---|---|
Author | dixonepperson |
Post date | 2003-08-27T15:20:05Z |
--- In firebird-support@yahoogroups.com, "Arno Brinkman"
<firebird@a...> wrote:
yours seems to return the accurate totals, (need to check a little
more) and only one line per company. Big Question, is this the most
efficient way to do this? I expect over time this table will become
rather large. I would like to get this sql on steroids
Dixon
<firebird@a...> wrote:
> Hi,This one works best. Mine was returning multiple results per company,
>
yours seems to return the accurate totals, (need to check a little
more) and only one line per company. Big Question, is this the most
efficient way to do this? I expect over time this table will become
rather large. I would like to get this sql on steroids
> SELECTThanx
> c1.CO_NAME,
> (SELECT SUM(s2.SA_TOTAL) FROM SALESREG s2
> WHERE (s2.SA_INVDATE BETWEEN '8/21/2003' AND '8/27/2003') AND
> s2.SA_CUSTID = c1.CO_IDNUM),
>
> (SELECT SUM(s2.SA_TOTAL) FROM SALESREG s2
> WHERE (s2.SA_INVDATE BETWEEN '8/15/2003' AND '8/20/2003') AND
> s2.SA_CUSTID = c1.CO_IDNUM),
>
> (SELECT SUM(s2.SA_TOTAL) FROM SALESREG s2
> WHERE (s2.SA_INVDATE BETWEEN '8/11/2003' AND '8/14/2003') AND
> s2.SA_CUSTID = c1.CO_IDNUM)
>
> FROM
> SALESREG s1
> LEFT JOIN COMPANY c1 ON (s1.SA_CUSTID = c1.CO_IDNUM)
> GROUP BY
> c1.CO_NAME,
> c1.CO_IDNUM
>
Dixon
> Regards,
> Arno Brinkman
> ABVisie
>
> -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
> Firebird links :
> http://www.firebirdsql.com
> http://www.firebirdsql.info
> http://www.fingerbird.de/
> http://www.comunidade-firebird.org/
>
>
> Nederlandse firebird nieuwsgroep :
> news://80.126.130.81