Subject Re: [firebird-php] SQL query help to generate tota - subtotal and grand total
Author Umberto Masotti
Hi David,
I don't see yet my answer, so I'll try to resend.

David ha scritto:
> I try your query but stop in: USING
> and this is the error I'm getting.
> SQL error code = -104.
> Token unknown - line 3, column 34.
> using.
>
USING is a new syntax introduced in FB2.1: see in
http://www.firebirdsql.org/rlsnotesh/rlsnotes210.html#rnfb210-joins

Derived tables were introduced instead in FB2.0
http://www.firebirdsql.org/rlsnotesh/rlsnotes210.html#rnfb20x-dml-derived-tables

The reported error is in the third line:

(TRANS t inner join STUDENT s USING (STUD_NO))

that can be rewritten as:
(TRANS t inner join STUDENT s ON (t.STUD_NO = s.STUD_NO))

Note that parenthesis are needed to correctly group JOINs.


Ciao.
Mimmo.