Mark duplicated values in a power table

Hi there.

I´m using a power table to show statistical information and I need to mark duplicated values (same column). How can I do it?

imagen

Your specification is underdefined.

  1. Is it only the UUID column that is to be checked?
  2. What is supposed to happen if there are two or more sets of duplicates? Do you need to color each set differently?

Hi.

Only UUID column must be checked and changing color is not needed for more sets of duplicates

Where is the data coming from?
Can a duplicate happen anywhere in a given column, or is it guaranteed to be sequential?

It's going to be very expensive to calculate this the naive way (for each row in the table, check every other row for a match), so if you can e.g. run a separate DB query to return the set of duplicate IDs that would help enormously.

A query like that shown below would show you the problem items.

SELECT
    max(machine), UUID, COUNT(*)
FROM
    Product
GROUP BY
    UUID
HAVING 
    COUNT(*) > 1

Result:

max(machine) UUID COUNT(*)
12705 0028185551 3
12704 0028185552 2

You can play with the query on SQL Fiddle.

If you just want to count the duplicate UUIDs you could add another column to your source query (assuming its some flavour of SQL)

COUNT(*) OVER (PARTITION BY UUID) as [Duplicate_Count]

Anything > 1 would have duplicates. You could use that column to format the rest of the row, and then hide it.

2 Likes