COGNOiSe.com - The IBM Cognos Community

IBM Cognos 10 Platform => Cognos 10 BI => Report Studio => Topic started by: psrpsrpsr on 02 Aug 2017 08:46:30 AM

Title: How can you identify/return duplicate rows?
Post by: psrpsrpsr on 02 Aug 2017 08:46:30 AM
In SQL it's easy to identify duplicate rows by using GROUP BY and HAVING:

SELECT [field1],[field2],COUNT(*)
FROM tbl
GROUP BY [field1],[field2]
HAVING COUNT(*) > 1                 (https://stackoverflow.com/questions/2594829/finding-duplicate-values-in-a-sql-table)

How can you achieve this in Cognos? Are there multiple ways, and if so, what would be the 'best' by convention?

Thanks all
Title: Re: How can you identify/return duplicate rows?
Post by: hespora on 02 Aug 2017 09:04:15 AM
Same thing, really.

create one data item

count(
  [any field you might have]
  for [field1],[field2]
)

and filter on that data item >1, with filter after auto aggregation.
Title: Re: How can you identify/return duplicate rows?
Post by: psrpsrpsr on 02 Aug 2017 01:41:40 PM
Excellent! Have an appluad :)
Title: Re: How can you identify/return duplicate rows?
Post by: hespora on 03 Aug 2017 02:16:44 AM
glad I could help! :)