SQL HELP

Arrow11

Well-known member
  • May 24, 2014
    22,217
    1,659
    113
    හීන මාලිගාවේ ❤❤
    machanla Invoice kiyala table ekak tiyanawa..meke customerts good receive unama hand over goods kiyala table ekakata watenna hadala tiyenne.habai handover table ekata data giyata invoice eken e data tika remove wenna ba.

    Dan mata display karaganna ona handoverover table eke nathi invoice ekata witarak aithiu records tika!!eka ganne kohomada??


    example invoice table example handover table
    id name id name
    1 ss 1 ss
    2 bb 3 cc
    3 cc

    mata dan display karagaganne ona invoice table eke tiyana handover eke nathi data tika?me example eke widiyatanam 2 bb kiyana eka?
     

    thinking_guy

    Well-known member
  • Apr 16, 2011
    4,718
    2,737
    113
    machanla Invoice kiyala table ekak tiyanawa..meke customerts good receive unama hand over goods kiyala table ekakata watenna hadala tiyenne.habai handover table ekata data giyata invoice eken e data tika remove wenna ba.

    Dan mata display karaganna ona handoverover table eke nathi invoice ekata witarak aithiu records tika!!eka ganne kohomada??


    example invoice table example handover table
    id name id name
    1 ss 1 ss
    2 bb 3 cc
    3 cc

    mata dan display karagaganne ona invoice table eke tiyana handover eke nathi data tika?me example eke widiyatanam 2 bb kiyana eka?

    Select invoice_table.*, handover_table.* From invoice_table Left Join handover_table on invoice_table.id = handover_table.id where handover.id = dbnull

    Meka adala SQL version eke widiyata wenas karala try karala balpan.
     

    kalhara96

    Well-known member
  • Aug 7, 2010
    4,912
    2,979
    113
    අහවල් තැන
    try this machan

    MINUS operator එක use කරපන් මචන්

    මචන් මන් මෙහෙම හිතල උත්තරේ දෙන්නෙ.

    ** Invoice table එකේ record එකක primary key එක invoice_ID කියල ගමු.
    ** Handover_Goods table එකට record 1ක් add වෙනකොට අර invoice_ID එක foreign key 1ක් විදිහට save වෙනවා.

    එතකොට මේ query එකෙන් ඔයාට ඕනෙ result එක ගන්න පුළුවන්.

    SELECT invoice_ID FROM Invoice
    MINUS
    SELECT invoice_ID FROM Handover_Goods;


    P.S : මේක Oracle වලටයි ලිව්වෙ.
    අනිත් ඒවගෙනම් syntax පොඩ්ඩක් වෙනස් වෙනවද දන්නෙ නැහැ....