我需要能够为插入设置多个select语句或值。如果我删除第二列名称(notication_timestamp),以下工作。
insert into notification (msg,notification_timestamp) select msg from data;
我希望能够说:
insert into notification (msg,notification_timestamp) values (select msg from data,now());
但这不起作用。有什么想法吗?
答案 0 :(得分:5)
删除values语句:
Insert into notification(msg, notification_timestamp)
Select msg, now()
from data
答案 1 :(得分:2)
您没有将notification_timestamp
放在选择查询
insert into notification (msg,notification_timestamp) select msg,'value for notification_timestamp' from data;
所以可能
insert into notification (msg,notification_timestamp) select msg,now() from data;