massmaharaj Posted January 28, 2013 Report Posted January 28, 2013 i ahe 2 tables a and b b have total 5 columns, i have to update 3 columns in a table a using 3 coulmns from b with join other 2 columns with table a i have tried all google answers didnot find any luck please help if you worked in real time
CheGuevara Posted January 28, 2013 Report Posted January 28, 2013 [quote name='massmaharaj' timestamp='1359408887' post='1303191542'] i ahe 2 tables a and b b have total 5 columns, i have to update 3 columns in a table a using 3 coulmns from b with join other 2 columns with table a i have tried all google answers didnot find any luck please help if you worked in real time [/quote] edigo gatla english kadu gani...mana matru basha lo manchiga cheppu ardamayyela
vikuba Posted January 28, 2013 Report Posted January 28, 2013 https://forums.oracle.com/forums/thread.jspa?threadID=2243826 https://forums.oracle.com/forums/thread.jspa?threadID=399752 http://stackoverflow.com/questions/2446764/oracle-update-statement-with-inner-join
vikuba Posted January 28, 2013 Report Posted January 28, 2013 http://dba.stackexchange.com/questions/3033/how-to-update-a-table-from-a-another-table
massmaharaj Posted January 28, 2013 Author Report Posted January 28, 2013 naaku 2 tables unnayi a table loki data ni update cheyali btable lo data untundi b table lo total 5 columns untayi andulo 3 columns thesukoni veli a table to update table by joining 2 b table columns with 2 a table columns
CheGuevara Posted January 28, 2013 Report Posted January 28, 2013 [quote name='massmaharaj' timestamp='1359409532' post='1303191614'] naaku 2 tables unnayi a table loki data ni update cheyali btable lo data untundi b table lo total 5 columns untayi andulo 3 columns thesukoni veli a table to update table by joining 2 b table columns with 2 a table columns [/quote] aa tables madyalo amina relation unda...assalu aa tables structure veyyi ...
massmaharaj Posted January 28, 2013 Author Report Posted January 28, 2013 table a -id, start_dt,end_dt, term_dt,ind_yn ( this has history) here id and start_dt have unique combinatino table b - id, start_dt,end_dt,term_dt,ind_yn now i want to update end_dt,term_dt, ind_yn in table a using table b's end_dt,term_dt, ind_yn by joining id and start_dt in a and b
massmaharaj Posted January 28, 2013 Author Report Posted January 28, 2013 [list] [*]UPDATE A [*]SET ( A.col2, A.col4 ) = [*]( SELECT B.col2, B.col4 [*] FROM B [*] WHERE B.col1 = A.col1 [*]) [*]WHERE EXISTS [*]( SELECT B.col2, B.col4 [*] FROM B [*] WHERE B.col1 = A.col1 [*]) [/list] [size=3][background=white] i got it the aboev sql i used [/background][/size]
CheGuevara Posted January 28, 2013 Report Posted January 28, 2013 UPDATE a SET (a.col3, a.col4,a.col5) = ( SELECT b.col3,b.col4,b.col5 from b WHERE b.col1 = a.col1 and b.col2=a.col2);
Recommended Posts