我的表格看起来像这样
PlayerID PlayerName Score
1 koates 0
2 tberckley 0
3 testAcc 3
我想得到玩家的名字:koates和testAcc作为结果显示但是我写的内容显示了两个结果,但是单独的结果。
SELECT * FROM Players WHERE PlayerName='koates'
SELECT * FROM Players WHERE PlayerName='testAcc'
我正在为游戏制作一个简单的登录页面,它会查找此人输入的用户名
答案 0 :(得分:4)
您正在寻找IN
将两者结合起来:
select *
from Players
where PlayerName in ('koates', 'testAcc');
答案 1 :(得分:0)
示例查询:
select Result from
(
select 'PlayerName' as Result from [Yourtablename]
union
select 'Score' as Result from [Yourtablename]
)tt
where Result is not null;