Jump to content

Sql Select * From In (tablo İçi̇nde Tablo Sorgusu)


Anarchosa
 Share

Recommended Posts

SQL'DE kendi kendime çalışıyorum çalışırken bir sorgu yazdım ancak bağlantıyı kuramadım, örnek veriyorum, bir ürünü silmek istiyorum;

Stok Tablosundan ürünün adını silmek istiyorum.
Stok barkod tablosundan stoğa bağlı barkodunu silmek istiyorum,
Stoğa bağlı birimi silmek istiyorum.

Stoğa bağlı fiyat ID'sini silmek istiyorum.

1 stok 4 farklı tabloya yazıldığını düşünürsek ürünü kademeli DELETE kodu çalışması gerekiyorki doğru şekilde silinmesi olsun.

 

SELECT * FROM STOK WHERE ID IN (SELECT * FROM STOK_STOK_BIRIM WHERE STOK IN (SELECT * FROM STOK_STOK_BIRIM_FIYAT WHERE STOK_STOK_BIRIM IN (SELECT * FROM STOK_BARKOD WHERE BARKOD=8690123202379))

 

Sorguyu böyle yazdım acaba sorun tam nerededir.; Hatası alıyorum

Msg 116, Level 16, State 1, Line 29
Only one expression can be specified in the select list when the subquery is not introduced with EXISTS.
Msg 116, Level 16, State 1, Line 29
Only one expression can be specified in the select list when the subquery is not introduced with EXISTS.
Msg 116, Level 16, State 1, Line 29
Only one expression can be specified in the select list when the subquery is not introduced with EXISTS.

Link to comment
Share on other sites

Bu sorguyu SQL sorgu arayüzüne yapıştırıp bilgi verirmisin.

SELECT * 
FROM STOK 
WHERE ID IN (
    SELECT stok_id 
    FROM STOK_STOK_BIRIM 
    WHERE stok_id IN (
        SELECT stok_id 
        FROM STOK_STOK_BIRIM_FIYAT 
        WHERE stok_stok_birim_id IN (
            SELECT stok_stok_birim_id 
            FROM STOK_BARKOD 
            WHERE BARKOD = '8690123202379'
        )
    )
);

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...