Subject | Re: [ib-support] Count and distinct |
---|---|
Author | Lucas Franzen |
Post date | 2003-01-15T10:44:06Z |
Lester Caine schrieb:
SELECT COUNT(*) AS CNT, x, y
FROM YOURTABLE
GROUP BY X, Y
walk through the result and sum the CNT fields....
(or let it sum by a stored proc)
Luc.
>And if there's no "safe character" you still can try using
> Jason Chapman (JAC2) wrote:
> > Hi Ann,
> > Row 1:
> > x = 'ABC'
> > y = 'DEF'
> > Row 2:
> > x= 'ABCDE'
> > y= 'F'
> >
> > Would break that wouldn't it.
>
> >>select count (distinct (x || y)) from <table>
>
> So -
>
> distinct (x || '!' || y)
>
> where the ! is a 'safe character for your application.
SELECT COUNT(*) AS CNT, x, y
FROM YOURTABLE
GROUP BY X, Y
walk through the result and sum the CNT fields....
(or let it sum by a stored proc)
Luc.