This topic has been archived. It cannot be replied.
-
工作学习 / 专业技术讨论 / Question about SQL SELECTIn MySQL, I have 2 tables:
1. customer ( uid intr, name char(24))
2. program ( id int, member1 int, member2 int, ....)
How to use one 'SELECT to show
program.id, member1's name, member2's name
Thanks
-kuma(kuma);
2006-10-12
{214}
(#3257564@0)
-
try this:select
p.id,
c1.name,
c2.name
from
program p,
customer c1,
customer c2
where
p.member1 = c1.uid
and p.member2 = c2.uid
-sailor(Sailor);
2006-10-12
{128}
(#3257578@0)
-
高手
-ccra(ccra);
2006-10-12
(#3257662@0)
-
Thanks. It works.
-kuma(kuma);
2006-10-12
(#3257835@0)
-
这table设计的够烂。。。
-canadiantire(轮胎-pax et lux);
2006-10-12
(#3257774@0)
-
Do you have any good idea?
-kuma(kuma);
2006-10-12
(#3257842@0)
-
normalize it.
-canadiantire(轮胎-pax et lux);
2006-10-12
(#3257856@0)
-
Please adviseI already have user table which include members' detail information. Now the create a program table, each program has at least 5 members: manager, sales, contact name, local contact name...
Do you mean I just use the name directly, instead of using ID?
-kuma(kuma);
2006-10-12
{256}
(#3257890@0)
-
Oops... This is in a pretty thick book, taught at the 4th year of undergraduate study.If possible you may go to take the course of "Database Concept" in a university, such as York or UofT. There is no quick thing that can be explained by merely a couple articles.
-sailor(Sailor);
2006-10-12
{180}
(#3257916@0)