由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Linux版 - 帮个SQL的忙
相关主题
VNC连不上Linux上面的vncserver怎么办?How to upgrade Ubuntu from 8.10 to 13.04
Samba + NFS + intensive backup 靠谱么?how to get rid of the column info row in mysql query?
大家都是如何作备份的呢?已经升到10.04的同修帮个忙
how to tar files in a folder whose last modified days from 7 days ago to now?Query packages by files
tar问题microsoft really knows how to do bussiness
有没有人是从8.04在线升级到10.04的?在ubuntu上面如何连接MS SQL数据库?
大家用什么build tool?linux下面有啥免费的sql数据库没?
请为家用服务器推荐一个备份的软件 (转载)The command line is powerful, but the UI can be more efficient!
相关话题的讨论汇总
话题: given话题: query话题: latest话题: key话题: reutn
进入Linux版参与讨论
1 (共1页)
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..

1 (共1页)
进入Linux版参与讨论
相关主题
The command line is powerful, but the UI can be more efficient!tar问题
A SQL query never stop running is bothering me: help needed!有没有人是从8.04在线升级到10.04的?
Re: 外行求查询script,管用发包子 (转载)大家用什么build tool?
一个SQL query的问题请为家用服务器推荐一个备份的软件 (转载)
VNC连不上Linux上面的vncserver怎么办?How to upgrade Ubuntu from 8.10 to 13.04
Samba + NFS + intensive backup 靠谱么?how to get rid of the column info row in mysql query?
大家都是如何作备份的呢?已经升到10.04的同修帮个忙
how to tar files in a folder whose last modified days from 7 days ago to now?Query packages by files
相关话题的讨论汇总
话题: given话题: query话题: latest话题: key话题: reutn