• 09-07-2021, 13:59:07
    #1
    Merhaba,

    İki Tablom var.

    istek
    ID, istekAd
    1 - A
    2 - B
    3 - C
    4 - D

    istekalan
    ID, istekID,
    1 - 1
    2 - 3

    Yulkarıdaki Tablolara göre istediğim sorguda bana 2 - B ve 4 - D vermesi gerekiyor.

    istekalan içinde olmayan istekleri listelemek istiyorum.
  • 09-07-2021, 17:04:59
    #2
    create table Test(id integer, title varchar(100));
    insert into Test(id, title) values(1, "A");
    insert into Test(id, title) values(2, "B");
    insert into Test(id, title) values(3, "C");
    insert into Test(id, title) values(4, "D");

    create table Test2(id integer, id2 integer);
    insert into Test2(id, id2) values(1, 1);
    insert into Test2(id, id2) values(2, 3);


    Ağağıdaki kodu daha iyi anlayabilmen için yukarıda tablolarını oluşturdum.

    select * from Test t1 where id not in (select id2 from Test2)