[Solved] Query the number of Duplicates per item in a table

Discuss the database features
Post Reply
securityrunsblue
Posts: 2
Joined: Tue Dec 21, 2021 12:40 am

[Solved] Query the number of Duplicates per item in a table

Post by securityrunsblue »

Happy Holidays,
I'm trying to learn Databases so please go easy on me,,,, I have a large db that I'm attempting to query to see how many recurrences there are for tickets coming in so I can start creating SOP / KB's for the most frequent ones. These are system generated event tickets so the Summary title is standardized for the most part. I was able to convert the CSV to ODS and import it into Base with no problem but when I try to query it with the wizard I'm not seeing a way to pull what I'm needing. I am trying to learn so if there is a query you can share that would do this or any other way besides the wizard I'd appreciate it, I'm sorry if this is such a basic question,,, I've searched online and haven't been able to find a suitable answer yet. If anyone knows how to do this I'd appreciate the help. Thanks!

Image
Last edited by securityrunsblue on Fri Dec 24, 2021 1:04 am, edited 1 time in total.
OpenOffice 7.2.4.1 (x64) on Windows 10 21H1 (Build 19043.1415)
F3K Total
Volunteer
Posts: 1038
Joined: Fri Dec 16, 2011 8:20 pm

Re: Query the number of Duplicates per item in a table

Post by F3K Total »

Hello,

let's say you have a table DATA, and a Column TEXT.
You now want to know, how many recurrences of each text are in table DATA, then the following query should do the job.

Code: Select all

SELECT "TEXT", COUNT( * ) AS "Recurrences" FROM "DATA" GROUP BY "TEXT" ORDER BY "Recurrences" DESC
For entering the query, change to Queries in your Basedocument, then Create Query in SQL View..., see picture
count.png
Copy/Paste or type in the Queries-SQL-Code above.
Save it, e.g. as qRecurrences, close it, an doubleclick the Query.
Here's the result, on the left the table DATA, on the right the Query qRecurrences
count2.png
find attached a sample-file
R
Attachments
Count_Duplicates.odb
(108.14 KiB) Downloaded 112 times
  • MMove 1.0.6
  • Extension for easy, exact positioning of shapes, pictures, controls, frames ...
  • my current system
  • Windows 10 AOO, LOLinux Mint AOO, LO
securityrunsblue
Posts: 2
Joined: Tue Dec 21, 2021 12:40 am

Re: Query the number of Duplicates per item in a table

Post by securityrunsblue »

Thanks,, this was exactly what I needed! :)
OpenOffice 7.2.4.1 (x64) on Windows 10 21H1 (Build 19043.1415)
Post Reply