帮我解决这个问题, [英] help me with this queries,,

查看:87
本文介绍了帮我解决这个问题,的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我两天前陷入这种情况,希望能帮助我解决..
我有3张桌子..
阶段> stag_Id,stage_name
测试> test_Id,stage_Id
结果> player_Id,test_Id,标记

我正在尝试做两个查询..
首先..显示播放器测试过的"舞台名称" ..
第二..先前阶段的选择显示了这些测试的结果
我已经写了第一个,但是在仅出现一个阶段并且始终是第一个阶段的情况下无法正常工作

Hi,,

I''m stuck in this situation two days ago and I hope to help me in solving it ..
i have 3 tables ..
stages >stag_Id,stage_name
tests >test_Id,stage_Id
results >player_Id,test_Id,mark

I''m trying to do two queries ..
First .. Show "stage name" tested by the player ..
Second .. the choice of the previous phases show the results of these tests
I''ve written the first but does not work properly where it appears only one phase and be the first always

"SELECT STAGES.stage_ID,STAGES.stage_name,TESTS.test_ID from STAGES INNER JOIN TESTS ON STAGES.stage_ID=TESTS.stage_ID INNER JOIN RESULTS ON TESTS.test_ID=RESULTS.test_ID"




编辑
我的问题是..
我想查询特定玩家测试过的阶段
然后查询该测试标记

源代码: https: //skydrive.live.com/redir.aspx?cid=20b9c18cb92126e5&resid=20B9C18CB92126E5!288&parid=root [ ]

plz help




Edit
My question is ..
I want to query about the stages that tested by a specific player
Then query for this test mark

source code:https://skydrive.live.com/redir.aspx?cid=20b9c18cb92126e5&resid=20B9C18CB92126E5!288&parid=root[^][]

plz help

推荐答案

尝试以下操作:
所有玩家测试的阶段名称
Try this:
Stage name tested by all players
SELECT R.player_id, T.test.id, S.stage_name, R.mark
FROM RESULTS AS R
    INNER JOIN TESTS AS T ON R.test_id=T.test_ID
    INNER JOIN STAGES AS S ON S.stage_Id=T.stage_Id



所选玩家测试的阶段名称
使用与上述相同的查询,



Stage name tested by selected player
Use the same query as above and

WHERE R.player_id = @player_id


用正确的值替换@player_id


replace @player_id with correct value


这篇关于帮我解决这个问题,的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆