我正在使用Microsoft SQL Server Management 2016
我正在试图弄清楚有多少玩家在19/1年1月1日之前有一场最后一场比赛,事情是我不知道我的代码是否正确,因为它没有任何回归。
SELECT deathDate, finalGameDate FROM Players
WHERE deathDate IS NOT NULL AND deathDate = '1990/01/01' and finalGameDate IS NOT NULL
我也试图找出谁更倾向于体重,国内出生或外国出生的球员,这里也有一些数据表,我试图做出声明,我无法想象它让我不断得到左右错误;这是我从头开始的基本选择。我已经尝试过函数,这就是我得到错误的地方。
SELECT weight, birthCountry FROM Players where birthCountry is not null
and weight is not null
答案 0 :(得分:1)
尝试:
SELECT deathDate, finalGameDate FROM Players
WHERE Convert(datetime,finalGameDate) <= '1990/01/01'
AND deathDate Is Not NULL
尝试:
SELECT
weight, birthCountry,
case When birthCountry = 'USA' then 'Domestic-Born'
Else 'Foreign-Born'
End as [Born]
FROM Players Order by weight desc