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 -

Why does a .NET 4.0 program produce a system.unauthorizedAccess error on a Windows Server 2012 machine with .NET 4.5 installed? -