mysql - Do I really have to create a temp table? -


just wondering if knows neater way of doing following without creating , dropping table?

create temporary table temp_table select table_one.col1 table_one join table_two on (table_two.col1 = table_one.col1 ) table_one.col2 = $arg1 , table_two.col2= $arg2;  update table_two set col3 = $arg3 col1 in  (     select col1 temp_table );  drop table temp_table; 

you join in update statement.

update table_two, table_one set table_two.col3 = $arg3 table_two.col1=table_one.col1 , table_one.col2 = $arg1 , table_two.col2= $arg2; 

Comments

Popular posts from this blog

delphi - How to convert bitmaps to video? -

jasper reports - Fixed header in Excel using JasperReports -

python - ('The SQL contains 0 parameter markers, but 50 parameters were supplied', 'HY000') or TypeError: 'tuple' object is not callable -