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.
我有一个包含 id 和类型的表。
id type A1000123451 a B1000123450 b B1000123451 b B1000123452 b B1000123453 b A1000123452 a A1000123453 a
我想找到类型只有 b 的最大 id
意味着最大 id 是B1000123454
B1000123454
SELECT `id` FROM `myTable` WHERE `type` = 'b' ORDER BY `id` DESC LIMIT 0,1