Click to See Complete Forum and Search --> : Logic Neede


trends
October 8th, 2005, 04:23 AM
Hi all,

I am having A TABLE with datas like
I II
--------
10-50
11-50
11-70
50-75


I have to derive all the possible combinations for duplicates.for ex 50 gets repeated for 1 ,2 and 4the row.Now 10,11,75 are duplicates.Can anybody give me an idea how to implement this logic.

boumerlin
October 14th, 2005, 06:14 PM
How about something like:

create table CompareTable
(CompareField DataType,
FromField DataType)

Insert into CompareTable (CompareField, FromField)
values (FirstTable.Field1, "Column1")
from FirstTable

Insert into CompareTable (CompareField, FromField)
values (FirstTable.Field2, "Column2")
from FirstTable

select CompareField, Count(*)
from CompareTable
group by CompareField