I want to create new table from existing 2 table selected column, with new column contain '99999999' like dummy value.
I tried below code
CREATE TABLE NewTbl1
AS
SELECT a.col1, a.col2, a.col3, b.col4, b.col5, dummycol= '99999999'
FROM tbl1 a tbl2 b
WHERE (a.col1 = b.colNum AND a.col2 = b.colnum1)
But I get an error that FROM keyword is not found. If I remove dummcol='99999999', then it executes properly.
Is it right query or wrong? If wrong please correct me
Use proper join
syntax and use the right syntax for aliases:
CREATE TABLE NewTbl1 as
SELECT a.col1, a.col2, a.col3, b.col4, b.col5, '99999999' as dummycol
FROM tbl1 a JOIN
tbl2 b
ON a.col1 = b.colNum AND a.col2 = b.colnum1;
CREATE TABLE NewTbl1
AS
SELECT a.col1, a.col2, a.col3, b.col4, b.col5, '99999999' as dummycol
FROM tbl1 a, tbl2 b
WHERE (a.col1 = b.colNum AND a.col2 = b.colnum1)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.