Subject Re: [firebird-support] query trouble
Author Ever Daniel Barreto Rojas
El 06/11/2007 a las 01:40 p.m., escribiste:
> im having trouble getting a query done
> suppose the table is called t and may contain duplicate records,
> i.e. records, where ALL fields are equal
> what i want the query to return is a list of all the fields in a
> duplicate record plus the count of occurences.
> so if table t is:
> a b c d
> 3 5 7 9
> 3 5 4 2
> 3 5 7 9
> 1 4 7 6
> 3 5 7 9
> 3 5 4 2
> the query should return:
> a b c d count
> 3 5 7 9 3
> 3 5 4 2 2
> does anyone have an idea?

I think that you can use the count function with group by clauses,
maybe something like...

SELECT a, b, c, d, count(a)
FROM t
GROUP BY a, b, c, d
ORDER BY a, b, c, d

Cordiales saludos,

-------------------
Ever Daniel Barreto Rojas
e.mail: ebarreto@... :: Nexus Information Technologies
web: www.nexusit.com.py
06/11/2007 02:47 p.m.

---------------------
"I suspect most samba developers are already technically insane...
Of course, since many of them are Australians, you can't tell."
- Linus Torvalds
---------------------