Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/sql/68.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何在mysql中同时在两个表中存储相同的时间戳_Mysql_Sql - Fatal编程技术网

如何在mysql中同时在两个表中存储相同的时间戳

如何在mysql中同时在两个表中存储相同的时间戳,mysql,sql,Mysql,Sql,我是一个新手,正在使用mysql。我有两个表产品和客户,两个表中都有一个列日期,当记录被修改时,该列日期存储当前时间戳。 现在,我必须更新两个表中的一行,但我希望当前时间戳在两个表中存储相同。我发现,更新不会同时使用多个表名。 我知道这一定很简单,但我不知道怎么做。也许我无法确定这样做的逻辑。 谢谢你帮了我的忙,很抱歉问了我一个蹩脚的问题:-p使用程序 delimiter | CREATE PROCEDURE updatewithtime(IN inputid int) BEGIN

我是一个新手,正在使用mysql。我有两个表产品客户,两个表中都有一个列日期,当记录被修改时,该列日期存储当前时间戳。 现在,我必须更新两个表中的一行,但我希望当前时间戳在两个表中存储相同。我发现,更新不会同时使用多个表名。 我知道这一定很简单,但我不知道怎么做。也许我无法确定这样做的逻辑。 谢谢你帮了我的忙,很抱歉问了我一个蹩脚的问题:-p

使用程序

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别忘了将其包含在交易。别忘了将其包含在交易中。别忘了将其包含在交易中。别忘了将其包含在交易中。