I want to insert to a table from a select statement, however, there are 3 columns returned from the select statement and the table has 4 columns, I would like to add 0 for all rows in the extra column. Can anyone give me a sample SQL query for that?
Thank you!
Just add in the '0' in your select.
INSERT INTO table_name (a,b,c,d) SELECT other_table.a AS a, other_table.b AS b, other_table.c AS c, '0' AS d FROM other_table
1.4m articles
1.4m replys
5 comments
57.0k users