Salam /您好,我想根据条件从一张桌子中选择值? [英] Salam/Hello, I want to select the values from one one table based on condition?

查看:40
本文介绍了Salam /您好,我想根据条件从一张桌子中选择值?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有数据表即结果

有5列

1-Session

2-Reg No

3课程ID

4班ID

5-考试ID -----------------有两种类型。 (中期考试和期末考试)

6-获得的分数



我的问题是如何从两个不同的颜色中选择记录这张桌子。即

期中考试期末考试

68 70

70 70

i我正在使用查询

从[考试ID] = 1的结果中选择[获得的标记]。此查询仅检索MID Exam值而不是两者,当我输入[Exam ID] = 2时,它会检索Final Exam值。我想以上述格式检索这两个值。



请帮忙!

I have Data Table namely Results
which have 5 columns
1-Session
2-Reg No
3-Course ID
4-Class ID
5-Exam ID----------------- have two types. (Mid Exam & Final Exam)
6-Obtained Marks

My question is that how can i select the records in two different coloumns from this table. i.e
Mid Exam Final Exam
68 70
70 70
i am using the query
Select [Obtained Marks] from Results where [Exam ID]=1. this query only retrieves MID Exam values not both, and when i typed [Exam ID]=2 then it retrieves Final Exam values. I want to retrieve both values in above mentioned format.

Please help!

推荐答案

我同意Wes ..如果你想要两者,不要包含where子句,它将返回所有结果。



如果你需要它,你可以使用WHERE [ExamId ] IN(1,2)。
I agree with Wes.. if you want both, do not include the where clause and it will return all results.

If you need to have it you can use "WHERE [ExamId] IN (1,2)".


这篇关于Salam /您好,我想根据条件从一张桌子中选择值?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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