原帖由 pwct 於 2008-11-24 10:14 發表
咁member table 除左(id, name) 仲有d咩?
score 無member_name
咁點知該參加者 佢所有評分項目係幾分?
同埋總分 係咪係score 加個項叫total?


每個score 都insert 一個record.
應該d code點寫?


score table 有member id 嘛, 咁就可以搵到個member name.
搵分數唔係靠member name, 而係靠member id.
如果你唔係有好多項目, 總分用sql 加埋score 就得, 不需另設total.

SQL 點寫你就要自己睇下書啦.

TOP

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

可以新增/減少 評分的項目 及其分數
不懂code 怎樣寫


每加一個項目就加一個match_item record, 就係咁簡單.

TOP

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

可以新增/減少 評分的項目 及其分數
不懂code 怎樣寫


php? jsp?

TOP

原帖由 thinkpanda 於 2008-11-24 10:29 發表


score table 有member id 嘛, 咁就可以搵到個member name.
搵分數唔係靠member name, 而係靠member id.
如果你唔係有好多項目, 總分用sql 加埋score 就得, 不需另設total.

SQL 點寫你就要自己睇下書啦.

讓我重新整理下
member (id, username, pw) - 注冊會員
app (id, match_id ,member_id, name) - 報名
match (id, name) - 比賽名
match_item (id, match_id, name) - 評分項目
score (id, "app_id"? ,match_item_id, score) - 項目評分

死啦,唔明tim
e+ match_item  同 score 係1對1?
member (id, username, pw) (1 , pwct , pw)
app (id, match_id ,member_id, name)   (1 ,1, 1,pwct)
match (id, name) ( 1, test)
match_item (id, match_id, name) ( 1 , 1, a) ( 2 , 1, a)
score (id, "app_id"?,match_item_id, score)  (1 ,1, 1, 70 ) (1 ,1, 2, 50 )  
then
pwct係比賽test   係a項目 = 70分?
pwct係比賽test   係b項目 = 50分?

咁樣?

咁score 咪都要加match_id 唔係點知邊個參加者參加邊項比賽?

[ 本帖最後由 pwct 於 2008-11-24 11:04 編輯 ]

TOP

原帖由 rocketdive04 於 2008-11-24 10:58 發表


php? jsp?

jsp~~~~~~~~~~

TOP

用返好d既id名來睇就係咁:
member(member_id,name)
app(member_id,match_id)
match(match_id,match_name)
match_item(match_id,match_item_id,match_item_name)
score(match_item_id,score)

同一場比賽(match),有兩種項目(match_item),每種項目有各自分數(score)。

不過有無必要將項目分數分出來做獨立table呢?
其實應該可以放落match_item度都得ga wo...

[ 本帖最後由 GPoker 於 2008-11-24 17:48 編輯 ]

TOP

原帖由 GPoker 於 2008-11-24 17:00 發表
用返好d既id名來睇就係咁:
member(member_id,name)
app(member_id,match_id)
match(match_id,match_name)
match_item(match_id,match_item_id,match_item_name)
type-score(match_item_id,score)

同一場比賽(match), ...


睇下分數係跟比賽定跟參賽者啦.

TOP

原帖由 GPoker 於 2008-11-24 17:00 發表
用返好d既id名來睇就係咁:
member(member_id,name)
app(member_id,match_id)
match(match_id,match_name)
match_item(match_id,match_item_id,match_item_name)
score(match_item_id,score)

同一場比賽(match),有兩種 ...

咁點知某會員係某比賽 既評分項目係幾分?
係咪無關聯到?

TOP

原帖由 pwct 於 2008-11-24 17:50 發表

咁點知某會員係某比賽 既評分項目係幾分?
係咪無關聯到?

關聯肯定有,不過係用select搞je...

select s.score from member m, match ma, match_item mi, score s
where m.member_name like "你要搵既人既名" and m.member_id = ma.match_id
and ma.match_id = mi.match_id and mi.match_item_id = s.match_item_id

不過就唔知我句statement有無錯啦

TOP

原帖由 GPoker 於 2008-11-25 14:47 發表

關聯肯定有,不過係用select搞je...

select s.score from member m, match ma, match_item mi, score s
where m.member_name like "你要搵既人既名" and m.member_id = ma.match_id
and ma.match_id = mi.match_id a ...

參加者同各評分項目分數係program 上面關聯
唔駛係mysql?
咁就可以做到
每個參加者 ( a,b,c,d,e ,total)[評分項目] ( 10,9,8,7,6,total) [分數]
咁樣?

TOP