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

[SQL] Joining two tables with a joint result in Postgresql

Discussão em 'Outras Linguagens' iniciado por Stack, Outubro 9, 2024 às 11:52.

  1. Stack

    Stack Membro Participativo

    There are two tables.

    table1

    select tt1.*
    from
    (values(1,'key1',5),(2,'key1',6),(3,'key1',7)
    ) as tt1(id, field2,field3)


    table2

    select tt2.*
    from
    (values(4,'key1',null),(2,'key1',null),(3,'key1',null)) as tt2(id, field2,field3)


    How can I combine these two tables in a query to get the result like this?

    select tt2.*
    from
    (values(1,'key1',5),(2,'key1',6),(3,'key1',7),(4,'key1',null)) as tt2(id,field2,field3)

    Continue reading...

Compartilhe esta Página