Duplicates in database view
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2 hours ago
I have this database view, data is reflecting correctly, but it is coming twice ( meaning duplicate), what should I change in the where clause to avoid duplicates records?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
33m ago
Hi @jay97 ,
You’ve built a database view that connects metric definition, metric instance, and your custom case table (x_amoss_csm_proc_case).
The problem is that one metric definition can link to many metric instances, and one case can link to many metric results.
Because of that, the same case shows up more than once — not because the data is wrong, but because the join is too broad.
Match on the unique ID (sys_id)
Add a filter to cut out extras
Keep only the fields you care about
The more fields you pull in, the more chances you’ll see duplicates.
Focus on the case number + metric you actually need.
Handle deduplication in reports if needed
ServiceNow’s database views don’t support fancy SQL like DISTINCT or GROUP BY.
If you still see duplicates, you can make your report show only unique rows.
