[Solved] A query which removes duplicates

Creating tables and queries
Post Reply
beejayzed
Posts: 4
Joined: Fri May 23, 2008 9:14 am

[Solved] A query which removes duplicates

Post by beejayzed »

Hi
I want to be able to enter values in a table, then have a query (or queries that work together) to do the following:
1. Remove the duplicates from the table.
2. Display how many values there are of each value.

e.g for 1,5,6,2,8,6,1,2
1:2 5:1 6:2 2:2 8:1

Any tips for doing this?
Thanks in advance.
Last edited by beejayzed on Sat May 24, 2008 2:30 am, edited 1 time in total.
User avatar
Villeroy
Volunteer
Posts: 31279
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: A query which removes duplicates

Post by Villeroy »

Code: Select all

SELECT "Value", COUNT("Value") AS "How Many" FROM "Table" GROUP BY "Value" ORDER BY "How Many"
If you add more fields, mind that every field needs to be grouped or aggregated by a one of SUM, COUNT, AVGERAGE, MIN, MAX. Every value in the result set represents one or more values in the original table.
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
beejayzed
Posts: 4
Joined: Fri May 23, 2008 9:14 am

Re: A query which removes duplicates

Post by beejayzed »

Thanks very much for the help.
Post Reply