1
I am adding mysql support to my program, currently only works with sql server, so I came across a problem with mysql.
Table sql server:
CREATE TABLE [dbo].[login_user](
[idx] [int] IDENTITY(1,1) NOT NULL,
[client_id] [int] NOT NULL,
[Login] [datetime] NULL,
[Logout] [datetime] NULL,
[Time] AS (datediff(second,[Login],[Logout])),
Mysql table:
CREATE TABLE IF NOT EXISTS `login_user` (
`idx` INT(11) UNSIGNED NOT NULL AUTO_INCREMENT,
`client_id` INT(11) UNSIGNED NOT NULL DEFAULT '0',
`login` DATETIME NULL,
`Logout` DATETIME NULL,
`Time` AS TIMESTAMPDIFF(second,`login`,`Logout`),
PRIMARY KEY (`idx`)
) ENGINE=MyISAM;
Well the mysql table import doesn’t work because it seems n accept TIMESTAMPDIFF, I don’t want to have to create an update in my code for the field Time
, want to keep in table equal is in sql server.
I believe you will need to use a Rigger to do this. But also try to remove the apostrophes from the fields in the function call, ie use TIMESTAMPDIFF(Login,Login,) instead of TIMESTAMPDIFF(Cond,
login
,Logout
)– GustavoAdolfo