wy 发帖数: 14511 | 1 3 tables:
a key(id)
b a_id, c_id
c key(id)
b.a_id and c_id point to a and c respectively.
Now, given c_id, I want to select all a where b.c_id = given c_id, but
only with the latest ones. id is auto increment, so "the latest" means
id being the largest. for example,
I have a(1), I have b(a_id = 1, c_id =1) and b(a_id=2, c_id = 2)
If given c_id =1, the query should *not* return a(1), but
given c_id = 2, the query should reutn a(1) |
|