Click here to Skip to main content
Rate this: bad
Please Sign up or sign in to vote.
See more: MySQL query Help
I am trying to create a new table using values from another table. The query I have so far is getting values from an existing table and inserting them into the new table, but I am trying to find the syntax for inserting a value into a unique column in new table as well as using values from another table. Can anybody help me?
MySqlConnection conn = new MySqlConnection(connectionSQL);
MySqlCommand cmd = new MySqlCommand("INSERT INTO TransactionsTemp(barcode, name, price) SELECT barcode, name, price FROM Product WHERE barcode='" + textBox1.Text + "'", conn);

Posted 10-Apr-13 5:57am
Edited 10-Apr-13 6:56am
joshrduncan2012 at 10-Apr-13 11:14am
Can you show us the code that you have already and pinpoint where the issue is?
Member 9611735 at 10-Apr-13 11:23am
Question has been updated with code

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

You can use 'ALTER table' as described in :[^]

Member 9611735 at 10-Apr-13 11:54am
the column already exists in table, I just want to extend query and insert value into column

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Advertise | Privacy | Mobile
Web01 | 2.8.150302.1 | Last Updated 10 Apr 2013
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100