1

我的插入需要能够有多个选择语句或值。如果我删除第二个列名(notication_timestamp),则以下工作。

insert into notification (msg,notification_timestamp) select msg from data;

我想能够说:

insert into notification (msg,notification_timestamp) values (select msg from data,now());

但这不起作用。有任何想法吗?

4

2 回答 2

5

删除值语句:

Insert into notification(msg, notification_timestamp)
    Select msg, now()
    from data
于 2012-05-13T03:51:06.133 回答
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;
于 2012-05-13T03:49:57.660 回答