I have 2 tables, one feeds data for another but I must add external value too
Is this query does the job ?
MySqlCommand cmd1 = new MySqlCommand("INSERT INTO tableA (dt1, dt2) SELECT (dt1, dt2) FROM tableB, @dt3, @dt4",conn1);
cmd1.Parameters.Add("@dt3", MySqlDbType.Int16).Value = 2;
cmd1.Parameters.Add("@dt4", MySqlDbType.Int16).Value = 0;
And would Update TableA with
LastId = Convert.ToInt32(cmd1.LastInsertedId);
Is it possible in one query ? And help will be very precisous.
Aucun commentaire:
Enregistrer un commentaire