Subject Re: [ib-support] Count and distinct
Author Ann W. Harrison
At 12:06 PM 1/15/2003 +0200, Gerhardus Geldenhuis wrote:
>Jason Chapman (JAC2) wrote:
> > Hi Ann,
> > Row 1:
> > 'ABC' 'DEF'
> > Row 2:
> > x= 'ABCDE' 'F'
> >
> > Would break that wouldn't it.

Yes, but one could probably add a term between the
two (three, four, n) column values that would allow
it to work. If you're using char columns, then there
is no ambiguity. If you're using varchar, you can
use a space - unless your data has leading spaces.

>What does the sql standard say of handling a scenario like this. For me
>it would make sense to be able to do a count(distinct(x,y,z)). It would
>be nice if FB could do it...

The SQL standard, at least the old one says this:

<general set function> ::=
<set function type>
<left paren> [ <set quantifier> ] <value expression> <right paren>

<set function type> ::=
AVG | MAX | MIN | SUM| COUNT

<set quantifier> ::= DISTINCT I ALL
Syntax Rules
4) The <value expression> simply contained in <set function specification>
shall not contain a
<set function specification> or a <subquery>. If the <value expression>
contains a <column
reference> that is an outer reference, then that outer reference shall be
the only <column
reference> contained in the <value expression>.
Note: Outer reference is defined in Subclause 6.4, "<column reference>".





Regards,

Ann
www.ibphoenix.com
We have answers.