mysql - How to insert a row to table with another table's row and an variable? -
there 2 table:
a: col1, col2 b: col3, col4
i want insert row table a, col2 selected table b's col3, col1 variable, how should this?
i'm considered sql:
insert a(col1, col2) select ?, col3 b col4=?
, troubled variable.
try this
declare @variable_name int; set @variable_name= your_value; insert a(col1, col2) select @variable_name, col3 b col4=[your_condition]
Comments
Post a Comment