I need to fetch max(date) from another table while inserting a record in present table here is my query
insert into table2 values (null,12,(select max(odate) from table1),0)
this code doesn't seem to work please help
I need to fetch max(date) from another table while inserting a record in present table here is my query
insert into table2 values (null,12,(select max(odate) from table1),0)
this code doesn't seem to work please help
Use insert . . . select
instead of insert . . . values
:
insert into table2
select null, 12, max(odate), 0
from table1;
As a note: you should get in the habit of including the column names in the insert()
statement.