How to run a report with a HAVING clause equivalent on only one table
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-09-2024 08:14 AM
Hello,
I am trying to find records in a table where a single added field occurs more than once. For context, we have an added field in our sys_user table (call it "unique_key") that should be unique, but is not currently defined as such. We want to fix that, but first we need to clean up any duplicates. So we want to group by this field and find all sets where the count > 1, but for only one table. Basically, I need to configure a report with the equivalent of this SQL:
SELECT unique_key, COUNT(*) FROM sys_user GROUP BY unique_key HAVING COUNT(*) > 1
How can I do this? Thanks
0 REPLIES 0