原帖由 pwct 於 2008-11-26 17:10 發表

所謂join ja係
member(id, name)
score(id, "member_id", score)
" "  咁就叫join 左?


唔係。有D好奇點解你會有咁既想法?
所謂join, 係一個SQL 既寫法

select * from member, score where member.id=score.member_id

如果你唔了解係SQL 點做join, 咁前面咁多人講既野其實你都唔會明白。
所以你搞清楚SQL 先。

TOP

唔知我有無諗錯

tblMember
M_Id,Name

資料:
tblMember
1,Ann
2,Peter
3,john

tblMatchItem
MI_Id,Name

資料:
tblMatchItem
1,100米
2,4x100米

tblScore
S_ID,M_ID,MI_Id,score
1,2,2,15s

Select M.Name, MI.Name, s.Score From tblMember m, tblMatchItem mi, tblScore s
Where m.M_id = s.M_Id AND mi.MI_Id = s.MI_Id AND MI_Name = '4x100米'

Result:
Peter,4x100米,15s

TOP

原帖由 thinkpanda 於 2008-11-26 17:19 發表


唔係。有D好奇點解你會有咁既想法?
所謂join, 係一個SQL 既寫法

select * from member, score where member.id=score.member_id

如果你唔了解係SQL 點做join, 咁前面咁多人講既野其實你都唔會明白。
所以你搞清楚SQL 先。

原來係咁
係sql將member.id =score.member_id

member_id先連去member個id到
我以為 打member_id 本身就會自動  = member.id
咁ja係 比賽報名 同 score
都join member_id 去 比賽報名 同 score  個table?

TOP

原帖由 超~ 於 2008-11-26 17:45 發表
唔知我有無諗錯

tblMember
M_Id,Name

資料:
tblMember
1,Ann
2,Peter
3,john

tblMatchItem
MI_Id,Name

資料:
tblMatchItem
1,100米
2,4x100米

tblScore
S_ID,M_ID,MI_Id,score
1,2,2,15s

Select M.Name, MI. ...

咁比賽有好多評分項目
score 個度 點
例如歌唱比賽
member(id,name)
1, peter

match (id ,member_id, name )
1, 1, singcontest

match_item (id , member_id,  match_id, name)
1, 1, 1, 唱功
2, 1, 1, 音準
3, 1, 1, 感情

score(id, member_id, match_id, match_item_id, score)
1, 1, 1, 1, 5
2, 1, 1, 2, 10
3, 1, 1, 3, 20


會咁樣?

TOP

原帖由 pwct 於 2008-11-26 17:10 發表

所謂join ja係
member(id, name)
score(id, "member_id", score)
" "  咁就叫join 左?


i can give an example
student_score table
scoreid 1 (int identity), studentid "1",  score "60"

studentdetails
studentid1, name John, description bla bla, bla bla

so when u use select statement
select scoreid, name, score from student_score table inner join studentdetails on  
studentdetails.studentid = student_score.studentid

result:
StudentID    name                 score
    1                 John                  60

[ 本帖最後由 rocketdive04 於 2008-11-27 08:57 編輯 ]

TOP

原帖由 rocketdive04 於 2008-11-27 08:55 發表


i can give an example
student_score table
scoreid 1 (int identity), studentid "1",  score "60"

studentdetails
studentid1, name John, description bla bla, bla bla

so when u use select statement
sel ...

咁裝評分項目個table
駛5駛放studentid?
因為會顯示
會員a
項目1 10分
項目2 20分
項目3 30分
總分 60分

TOP

我諗你真係應該去圖書館睇下d database o既書...唔駛分mysql/mssql..你先要o既係concept..之後先再做吧...

TOP

見你問到咁耐都未解決到,真係建議你去學下sql concept先...如果真係好急既,索性搵朋友幫你寫過個吧...

TOP

原帖由 GPoker 於 2008-11-27 15:19 發表
見你問到咁耐都未解決到,真係建議你去學下sql concept先...如果真係好急既,索性搵朋友幫你寫過個吧...

有人引導會識快d

TOP

原帖由 pwct 於 2008-11-27 15:48 發表

有人引導會識快d

http://www.w3schools.com/sql/default.asp
http://www.1keydata.com/tw/sql/sql.html

一個英文一個中文,先將你而家個case放下,慢慢學返先啦

TOP