I have the following table:
CREATE TABLE 'adm_historico_acesso' (
'id' int(10) UNSIGNED NOT NULL,
'data' timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
'ip' varchar(100) NOT NULL,
'usuario' varchar(100),
'codigo' varchar(100) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL
) ENGINE = MyISAM DEFAULT CHARSET = latin1;
I would like a select
to show the following result:
Show the last time that every usuario
logged in to the system (based on the date field), where the code field is destined for when it fails login
, then it would have to display the last valid login and last attempt to login with error (the code would have the result erro
).