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) | s***i 发帖数: 6149 | 2
what does the query return in these two cases then? don't
understand the logic..
【在 wy 的大作中提到】 : 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
| wy 发帖数: 14511 | 3 never mind, solved.
【在 s***i 的大作中提到】 : : what does the query return in these two cases then? don't : understand the logic..
|
|