查询审计表以检索状态更改时间

时间:2018-03-08 00:21:37

标签: mysql sql database

示例数据

ID    Verification time_created  time_updated 
70000 us           9/12/16 11:25 2/21/17 22:41 
70000 us           9/12/16 11:25  4/3/17 14:20 
70000 us           9/12/16 11:25  4/4/17 22:08 
70000 v            9/12/16 11:25  4/4/17 23:38 
70000 v            9/12/16 11:25 6/22/17 23:52 
70000 v            9/12/16 11:25 10/4/17 19:26 

我想提取状态从“us”更改为“v”的时间,由time_updated表示

我现在正在使用此查询:

select id,verification_status,min(time_updated)
from customer_account_aud
where verification_status='v'
group by id;

2 个答案:

答案 0 :(得分:0)

我很不确定你在问什么,但希望以下答案会对你有帮助,

select id,verification_status,time_updated
from customer_account_aud
where verification_status='v';

for more reference

答案 1 :(得分:-1)

选择(*来自customer_account_aud,其中verification_status ='v' GROUP BY Id,time_updated ORDER BY(time_updated))。第一();