DBAsupport.com Forums - Powered by vBulletin
Results 1 to 2 of 2

Thread: update query for three tables

  1. #1
    Join Date
    Nov 2020
    Posts
    1

    update query for three tables

    I need help in the below query :

    Req: I HAVE THREE COLUMNS FROM THREE TABLES

    TABLE3.FIRSTNAME TABLE3.LASTNAME TABLE1.ACCNAME
    HAR WAL HAR WAL
    ATT SSS ATT SSS
    I CREATED BELOW UPDATE QUERY TO UPDATE TABLE AND I NEED TO UPDATE TABLE 1ACCNAME WITH FISRTNAME LASTNAME BUT BELOW QUERY THROWING ERROR :"Ora-01427 single-row subquery returns more than one row"

    IM USING oRACLE SQL DEV

    UPDATE BPD.TABLE1
    SET BPD.TABLE1.ACCNAME =
    ( select BPD.TABLE3.FIRSTNAME || ' ' || BPD.TABLE3.LASTNAME
    from (( BPD.TABLE1
    INNER JOIN BPD.TABLE2 ON BPD.TABLE2.ACCID = BCPD.TABLE1.ID)
    INNER JOIN BPD.TABLE3 ON BCPD.TABLE2.CONTACTID =BPD.TABLE.ID )
    WHERE BPD.TABLE1.ID IN
    ( select BCPD.TABLE1.ID from BCPD.TABLE1 where rownum >=1));
    oracle

  2. #2
    Join Date
    Dec 2002
    Posts
    74
    That means your query is returning more than one row. You need to run the subquery to see if there are duplicates.

    select BPD.TABLE3.FIRSTNAME || ' ' || BPD.TABLE3.LASTNAME
    from (( BPD.TABLE1
    INNER JOIN BPD.TABLE2 ON BPD.TABLE2.ACCID = BCPD.TABLE1.ID)
    INNER JOIN BPD.TABLE3 ON BCPD.TABLE2.CONTACTID =BPD.TABLE.ID

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Click Here to Expand Forum to Full Width