Re: The keyword 'distinct' question
Posted in 1998
Kyle Campbell wrote:
>
> According to the BNF Grammar in the Informix Guide to SQL Syntax the
> following statement should be legal:
>
> Select distinct ( sum (distinct <col1> ) ) from <table>>
> It doesn't like the fact that I'm using nested 'distinct' key word. We
> need this or we'll have to rework our logic for other queries.
>
> Thanks,
> Kyle Campbell
> kyle@alh.com
The manual I have (Informix Guide to SQL: Syntax version 7.1) states on
page 1-399, "You can use the DISTINCT or UNIQUE keywords once in each
level of a query or subquery". That seems clear enough to me.
I suspect the problem is that SQL is such a non-orthogonal language that
the real BNF used by the parser is pretty incomprehensible to humans, so
Informix have simplified it in their railroad diagrams and added some
text qualifiers. A good reference to SQL-92 such as Melton & Simon or
Canaan & Otten will have the full BNF, which is absolutely guaranteed to
send you to sleep before you find the answer you want.
The Informix diagrams are wonderful - I thought railroad diagrams had
been forgotten since I last saw them in an old book on Pascal.
--
Peter Lancashire
Information Systems Specialist, Bayer plc
Eastern Way, Bury St Edmunds, Suffolk, IP32 7AH, UK
Tel: +44-1635-562258, Fax: +44-1635-562281
Mail: Peter.Lancashire.PL1@bayer.co.uk
---
My Internet plumbing does not allow me to mail and post news together.
Sorry.
All opinions are my own and not those of Bayer plc.
---
Join Infuse, the UK Informix User Group at http://www.infuse.co.uk/