1. Anuncie Aqui ! Entre em contato fdantas@4each.com.br

[SQL] Matching for 2 columns but matching all alternatives recuringly in SQL

Discussão em 'Outras Linguagens' iniciado por Stack, Outubro 17, 2024 às 12:32.

  1. Stack

    Stack Membro Participativo

    My data look like this

    Col_X Col_Y
    a b
    b c
    c d
    d e
    f g
    t y
    y r
    q w
    n m
    m k
    m z

    My final goal cluster table should be exactly like this:

    Cluster
    abcde
    fg
    nmkz
    qw
    tyr​

    My pseudo data

    select 'a' as x, 'b' as y union all
    select 'b' as x, 'c' as y union all
    select 'c' as x, 'd' as y union all
    select 'd' as x, 'e' as y union all
    select 'f' as x, 'g' as y union all
    select 't' as x, 'y' as y union all
    select 'y' as x, 'r' as y union all
    select 'q' as x, 'w' as y union all
    select 'n' as x, 'm' as y union all
    select 'm' as x, 'k' as y union all
    select 'm' as x, 'z' as y

    Continue reading...

Compartilhe esta Página