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

Popular posts from this blog

python - No exponential form of the z-axis in matplotlib-3D-plots -

c# - "Newtonsoft.Json.JsonSerializationException unable to find constructor to use for types" error when deserializing class -

c++ - How to tell if a type is a subclass using type_info? -