|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
hi
i have 2 tables table1 with columns LOGINID and NAME. table2 has columns NAME, ADDRESS, BILL_NO, DUE_AMT. Have created a new column in table2 named LOGINID and want to insert all the values of column LOGINID of table1 into the LOGINID column of table2. I know i am writing an incorrect update command : UPDATE TABLE2 SET TABLE2.LOGINID= (SELECT TABLE1.LOGINID FROM TABLE1, TABLE2 WHERE TABLE1.NAME=TABLE2.NAME) Now i am getting around 100 rows from the select query...how to resolve this ...i know this is simple but i donot have mcuh knowledge pls do respnond thanks |
|
#2
|
|||
|
|||
|
Your subquery is returning more than one record, please note the modification marked in red.
Your query: ----------- UPDATE TABLE2 SET TABLE2.LOGINID = (SELECT TABLE1.LOGINID FROM TABLE1, TABLE2 WHERE TABLE1.NAME=TABLE2.NAME) Solution: Please remove the TABLE2 from the subquery, as mentioned below; UPDATE TABLE2 SET TABLE2.LOGINID= (SELECT TABLE1.LOGINID FROM TABLE1 WHERE TABLE1.NAME=TABLE2.NAME) |
![]() |
| Viewing: Dev Shed Forums > Databases > Oracle Development > update statement query |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|