当前在线人数17137
首页 - 分类讨论区 - 电脑网络 - 数据库版 -阅读文章
未名交友
[更多]
[更多]
文章阅读:Re: how to write a SQL command line for this?
[同主题阅读] [版面: 数据库] [作者:tailang] , 2007年01月10日23:53:03
tailang
进入未名形象秀
我的博客
[上篇] [下篇] [同主题上篇] [同主题下篇]

发信人: tailang (西瓜太郎), 信区: Database
标  题: Re: how to write a SQL command line for this?
发信站: BBS 未名空间站 (Wed Jan 10 23:53:03 2007)

select t1.person as 'buyer', t2.person as 'seller'
from t as t1, t as t2
where t1.tran = 'buy' and t2.tran = 'sell' and t1.type = t2.type and t1.date
= t2.date and t1.person <> t2.person


btw, the table design seems weird to me.

【 在 smothery (字符) 的大作中提到: 】
: What if I want to retrieve all buy-sell pairs, which are in same type, on
: same date but with different person?     Thanks
: type     tran      date      person
: ---------------------------------
: A        buy       6/13       GS
: A        buy       6/14       AN
: B        buy       6/15       XS
: A       sell       6/13       ML
: A       sell       6/14       BF
: B       sell       6/15       XS
: ...................



--

※ 来源:·BBS 未名空间站 http://mitbbs.com·[FROM: 71.198.]

[上篇] [下篇] [同主题上篇] [同主题下篇]
[转寄] [转贴] [回信给作者] [修改文章] [删除文章] [同主题阅读] [从此处展开] [返回版面] [快速返回] [收藏] [举报]
 
回复文章
标题:
内 容:

未名交友
将您的链接放在这儿

友情链接


 

Site Map - Contact Us - Terms and Conditions - Privacy Policy

版权所有,未名空间(mitbbs.com),since 1996