with BASE
as ( select distinct [DISTINCT COLUMNS]
from [TABLE NAME]
where [FILTER])
, TUPS
as ( select [SUBSET OF DISTINCT COLUMNS]
from BASE
group by [SUBSET OF DISTINCT COLUMNS]
having count(*) > 1)
select /*+ parallel(4) */
B.*
from BASE B
inner join TUPS on (B.[SUBSET OF DISTINCT COLUMNS]) in ((TUPS.[SUBSET OF DISTINCT COLUMNS]))
order by B.[SUBSET OF DISTINCT COLUMNS];
Dienstag, 11. Oktober 2016
How to find the records with multiple value combinations of columns of a distinct superset combination of columns
Let's say you want to check whether the discount of online shopping cart is singular for the items of a shopping cart (Sounds strange but I am affraid this is real life in that very moment of my life. I personally feel this is a design flaw as there is a information of shopping cart level in a table of item level.)
Abonnieren
Kommentare zum Post (Atom)
Keine Kommentare:
Kommentar veröffentlichen