Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我需要有关此 sql 的帮助。我需要根据创建日期(字段名称-create_bill_date)找到每个电路 ID(字段名称-strip_ec_circuit_id)的最新日期。我只需要找到最新的日期,而其他的可以删除。你能帮我做这件事吗?
这是一个基本的 group by 查询,应该适用于任何数据库:
select strip_ec_circuit_id, max(create_bill_date) as lastDate from t group by strip_ec_circuit_id
我不确定你说的删除所有其他人是什么意思。你真的想从表中删除不是最大值的行吗?