如何在mysql中同时在两个表中存储相同的时间戳
我是一个新手,正在使用mysql。我有两个表产品和客户,两个表中都有一个列日期,当记录被修改时,该列日期存储当前时间戳。 现在,我必须更新两个表中的一行,但我希望当前时间戳在两个表中存储相同。我发现,更新不会同时使用多个表名。 我知道这一定很简单,但我不知道怎么做。也许我无法确定这样做的逻辑。 谢谢你帮了我的忙,很抱歉问了我一个蹩脚的问题:-p使用程序如何在mysql中同时在两个表中存储相同的时间戳,mysql,sql,Mysql,Sql,我是一个新手,正在使用mysql。我有两个表产品和客户,两个表中都有一个列日期,当记录被修改时,该列日期存储当前时间戳。 现在,我必须更新两个表中的一行,但我希望当前时间戳在两个表中存储相同。我发现,更新不会同时使用多个表名。 我知道这一定很简单,但我不知道怎么做。也许我无法确定这样做的逻辑。 谢谢你帮了我的忙,很抱歉问了我一个蹩脚的问题:-p使用程序 delimiter | CREATE PROCEDURE updatewithtime(IN inputid int) BEGIN
delimiter |
CREATE PROCEDURE updatewithtime(IN inputid int)
BEGIN
set @timestamp := now();
update products set date = @imestamp where id = inputid;
update customers set date = @imestamp where id = inputid;
END
|
delimiter ;
你可以这样称呼它
call updatewithtime(123);
使用程序
delimiter |
CREATE PROCEDURE updatewithtime(IN inputid int)
BEGIN
set @timestamp := now();
update products set date = @imestamp where id = inputid;
update customers set date = @imestamp where id = inputid;
END
|
delimiter ;
你可以这样称呼它
call updatewithtime(123);
使用程序
delimiter |
CREATE PROCEDURE updatewithtime(IN inputid int)
BEGIN
set @timestamp := now();
update products set date = @imestamp where id = inputid;
update customers set date = @imestamp where id = inputid;
END
|
delimiter ;
你可以这样称呼它
call updatewithtime(123);
使用程序
delimiter |
CREATE PROCEDURE updatewithtime(IN inputid int)
BEGIN
set @timestamp := now();
update products set date = @imestamp where id = inputid;
update customers set date = @imestamp where id = inputid;
END
|
delimiter ;
你可以这样称呼它
call updatewithtime(123);
注意:您不能使用限制
但我还是更喜欢juergen d(存储过程)给出的方法
注意:您不能使用限制
但我还是更喜欢juergen d(存储过程)给出的方法
注意:您不能使用限制
但我还是更喜欢juergen d(存储过程)给出的方法
注意:您不能使用限制
但我还是更喜欢juergen d(存储过程)给出的方法您是执行批更新还是简单行更新?简单行更新SIR您是执行批更新还是简单行更新?简单行更新SIR您是执行批更新还是简单行更新?简单行更新SIR您是执行批更新还是简单行更新?简单行更新SIR别忘了将其包含在交易。别忘了将其包含在交易中。别忘了将其包含在交易中。别忘了将其包含在交易中。