Subject | Re: Select - problem with Group by |
---|---|
Author | richardpln |
Post date | 2004-12-19T18:15:39Z |
Thank Helen and Alan for your precious help (it works ok). I will look
forward for this SQL92 syntax. What is the best reference on the net
and on book for any documentation ?
==========================
--- In firebird-support@yahoogroups.com, Helen Borrie <helebor@t...>
wrote:
forward for this SQL92 syntax. What is the best reference on the net
and on book for any documentation ?
==========================
--- In firebird-support@yahoogroups.com, Helen Borrie <helebor@t...>
wrote:
> At 08:52 PM 18/12/2004 +0000, you wrote:clearer to
>
> >SELECT
> >B.CODE_PROD ,
> >SUM(B.QTE_RECUE_ENT)
> >
> >FROM
> >RECEPTION_MARCHANDISE_MAITRE A,
> >RECEPTION_MARCHANDISE B
> >
> >where
> >A.NO_RECEPTION=B.NO_RECEPTION_MAITRE
> >AND DATE_RECUE='2004-12-17'
> >AND A.VALIDER='O'
> >AND A.NO_SUCC=3
> >GROUP BY B.CODE_PROD
> >
> >-----------
> > >From this, i want only B.CODE_PROD showing ACTIF='Y' from table
> >PRODUIT C to show. (Note: CODE_PROD are identical in both PRODUIT and
> >RECEPTION_MARCHANDISE tables). I have found no way to add this filter
> >to the existing script. Any one have an idea?
>
>
> First, use the SQL-92 explicit join syntax as it makes it much
> see where you are going!! It also makes it *much* easier when usingnever to
> replaceable parameters, since these apply to WHERE criteria and
> joining criteria.
>
> Also take care to alias everything properly (alias was missing from
> DATE_RECUE so I'm guessing here).
>
> SELECT
> B.CODE_PROD ,
> SUM(B.QTE_RECUE_ENT)
>
> FROM
> RECEPTION_MARCHANDISE_MAITRE A
> join RECEPTION_MARCHANDISE B
> on A.NO_RECEPTION=B.NO_RECEPTION_MAITRE
> join Produit P
> on B.Code_Prod = P.Code_Prod
>
> where
>
> b.DATE_RECUE='2004-12-17'
> AND A.VALIDER='O'
> AND A.NO_SUCC=3
> and P.Actif = 'Y'
>
> GROUP BY B.CODE_PROD
>
> ./heLen