I want to apply divide and conquer approach on the field value,
For example I have the field value like this
Value
32,36,12,65,85,9663
43,36,89,65,112,9663
36,63,12,65,95,123
32,36,12,85, 85,9663
Remember that these value are taken from ONLY one field i.e Value.
Apply the divide and conquer approach in such a manner that take the value of a single field and each row and divide the value into two half. Continue this process until single value until we reach the single value or single sub problems.
Apply the divide and conquer approach on all the value of field. When we get final value then match the value of two different rows. And check how much field value are similar (match or duplicated). If field values are match more then 80% then delete the duplicated value and keep the original entity.
Please help me in this regards!
Thanks
i have following code but i cant do it,
Code:
WITH t AS (
SELECT rowid AS rid
, STRING_TO_TABLE(value) AS vals
FROM tbl
)
SELECT t1.vals AS v1
, t2.vals AS v2
FROM t t1
JOIN t t2 ON t1.rid < t2.rid
--Perform a cartesian product of the table
WITH t AS (
SELECT rowid AS rid
, STRING_TO_TABLE(value) AS vals
FROM tbl
)
SELECT t1.vals AS v1
, t2.vals AS v2
, t1 MULTISET INTERSECT DISTINCT t2 AS t1_2
FROM t t1
JOIN t t2 ON t1.rid < t2.rid
WITH t AS (
SELECT rowid AS rid
, STRING_TO_TABLE(value) AS vals
FROM tbl
)
--Use the MULTISET INTERSECT operator to combine the two sets
SELECT v1, v2, v_1_2
FROM (
SELECT t1.vals AS v1
, t2.vals AS v2
, t1.vals MULTISET INTERSECT DISTINCT t2.vals AS v1_2
FROM t t1
JOIN t t2 ON t1.rid < t2.rid
)
WHERE CARDINALITY(v_1_2) >
0.8 * GREATEST(CARDINALITY(v1), CARDINALITY(v1))
thats why i need a that function that converts comma-separated list of values into a Nested Table.
So help me in this regards. Thanks