SQL使用“AND”+“OR”语句加入(SQL Join with “AND” + “OR” statement)
我遇到了这个SQL语句的问题。 我试图将结果限制为ID为'25'和'87'的玩家。 查询没有错误(我通过此查询得到每个PID)这是语句。
SELECT Rosters.PID, SUM( Rosters.Goals ) Goals, SUM( Rosters.Assists ) Assists, SUM( Rosters.PIM ) PIM, Rosters.TID, Players.pid, Players.firstname, Players.lastname, SUM((Rosters.Goals + Rosters.Assists)) AS Points, Teams.tid, Teams.teamname FROM Rosters INNER JOIN Players ON Rosters.PID = Players.pid INNER JOIN Teams ON Rosters.TID = Teams.tid WHERE ((Rosters.TID BETWEEN 9 AND 16) AND (Players.pid = 25 OR 87)) GROUP BY Players.pid ORDER BY Points DESC
我几乎可以肯定这是我缺乏SQL理解的原因,但W3C学校并没有提供更复杂的解决方案,我查找的Stack线程已经相当本地化。
I am having trouble with this SQL statement. I am trying to restrict the results to the players with the ID's '25' and '87'. There is no error on the query ( I am getting every PID with this query) This is the statement.
SELECT Rosters.PID, SUM( Rosters.Goals ) Goals, SUM( Rosters.Assists ) Assists, SUM( Rosters.PIM ) PIM, Rosters.TID, Players.pid, Players.firstname, Players.lastname, SUM((Rosters.Goals + Rosters.Assists)) AS Points, Teams.tid, Teams.teamname FROM Rosters INNER JOIN Players ON Rosters.PID = Players.pid INNER JOIN Teams ON Rosters.TID = Teams.tid WHERE ((Rosters.TID BETWEEN 9 AND 16) AND (Players.pid = 25 OR 87)) GROUP BY Players.pid ORDER BY Points DESC
I am almost certain this is the cause of my lack of SQL understanding, but W3C schools does not offer more complex solutions and the Stack threads I have looked up have been pretty localized.
Here is the current output. It should just be the players with Id's 25 and 87
原文:https://stackoverflow.com/questions/35309028
最满意答案
新主题编辑专门为2012年 :
http://visualstudiogallery.msdn.microsoft.com/366ad100-0003-4c9a-81a8-337d4e7ace05
与VS 2010风格的蓝色和其他几个...
New Theme editor Specifically for 2012:
http://visualstudiogallery.msdn.microsoft.com/366ad100-0003-4c9a-81a8-337d4e7ace05
Comes w/ VS 2010 style blue and a few others...
相关问答
更多-
我怎么知道我的VS2012是否有Entity Framework 5.0?(How do I know if my VS2012 has Entity Framework 5.0?)[2022-02-11]
Visual Studio 2012 Update 4不包含对EntityFramework的任何更新。 您可以在此处查看发布信息: http://www.visualstudio.com/news/2013-nov-13-vs 如果要更新EntityFramework,则需要更新项目引用以指向您心中所需的EF版本。 Nuget是一种了解外部依赖关系并轻松管理外部依赖关系的绝佳方式。 以下链接应指向正确的方向: http://msdn.microsoft.com/en-us/data/ee712906.as ... -
使用LocalDB安装VS2012和SSME 2012。(Installed VS2012 and SSME 2012 with LocalDB. What's the server name?)[2022-08-23]
(的LocalDB)\ V11.0 有关此SO线程的更多信息: SQL Server(localdb)\ v11.0解释 (localdb)\v11.0 More info at this SO thread: SQL Server (localdb)\v11.0 explained -
新主题编辑专门为2012年 : http://visualstudiogallery.msdn.microsoft.com/366ad100-0003-4c9a-81a8-337d4e7ace05 与VS 2010风格的蓝色和其他几个... New Theme editor Specifically for 2012: http://visualstudiogallery.msdn.microsoft.com/366ad100-0003-4c9a-81a8-337d4e7ace05 Comes w/ VS ...
-
VS2012 - “显示表格数据”(VS2012 - “Show Table Data”)[2022-07-22]
案例:我遇到的这个问题是基于安装SQL Server Express的。 一旦安装了SQL Server Express,连接字符串在VS2012中更新以使用此新实例。 解决方案:我卸载了SQL Server Express,并且必须更新VS2012中的连接字符串。 在WebConfig文件中,您要注意连接字符串的这部分: connectionString =“Data Source =(LocalDb)这是正确的。 您需要注释掉其他连接字符串: connectionString =“Data Source ... -
答案如下: 右键单击该项目。 选择构建自定义...选择正确的Cuda版本。 D'哦! The answer was as follows: Right click on the project. Select Build Customizations... Select the correct Cuda version. D'oh!
-
在VS2012中更改命令行参数后无法找到资源(Cannot Locate Resource After Changing the Command Line Arguments in VS2012)[2023-01-16]
以下两个步骤为我解决了这个问题: 从中更改装配设置中的后备语言 [assembly: NeutralResourcesLanguageAttribute("en-US", UltimateResourceFallbackLocation.Satellite)] 至 [assembly: NeutralResourcesLanguageAttribute("")] 删除项目的UI文化:en-US 也许有人可以详细说明。 我不明白为什么更改命令行参数会影响查找语言 ... -
我还没有试过在 VS 2012 之后安装VS 2008 ,但是在我的一台机器上,我以更典型的方式完成了VS VS 2008,然后是VS 2010,然后是VS 2012(全部3个并排),它的工作正常我。 所以我期望你可能要做的最糟糕的事情是再次重新安装VS 2012。 I haven't tried installing VS 2008 after VS 2012 but on one of my machines I did it in a more typical way: first VS 2008 t ...
-
如果JSON文件没有在浏览器上呈现并且您收到404错误,那么您可能面临mime类型处理问题,请参阅以下链接以解决问题, getJSON方法不起作用 If JSON file is not rendering on the browser and your are getting 404 error then you might be facing the mime type handling problem, please refer the below link which resolves the is ...
-
比较项目属性中调试和发布模式之间的设置。 您可以从构建中排除某些实现文件。 如果解决方案中有多个项目,那么您可能忘记在发布模式下设置它们之间的正确依赖关系。 Compare the settings between debug and release mode in your project properties. You may excluded some of your implementation files from build. If you have multiple projects in t ...
-
VS2012是BSOD Causer(VS2012 Is A BSOD Causer)[2024-01-29]
这是Visual Studio的一个已知问题 (显然是VS2010)和Ping类。 微软于06/02/2012 09:11发表 感谢您的反馈意见。 这是Ping类使用的基础Windows API的已知问题。 Windows团队将确定如何最好地处理该问题。 It's a known issue with Visual Studio (since VS2010, apparently) and the Ping class. Posted by Microsoft on 06/02/2012 at 09:11 ...