?
Solved

3 JOIN QUERY AGAIN

Posted on 2014-11-04
4
Medium Priority
?
151 Views
Last Modified: 2014-11-04
HEY i HAVE AN IDENTICAL SQL STATEMENT WORKING GOT ERROR MESSAGE ERROR NEAR where

Sql = " SELECT Injuries.Name, Injuries.Pos, Team.Fullname,Injuries.Date,Injuries.Injury,Injuries.Status,Injuries.Fantasy,Injuries.Type,"
        Sql += " Injuries.TeamID, Injuries.PlayerID"
        Sql += " FROM Injuries Join NFLPlayers np Join Injuries ON np.PlayerID = Injuries.PlayerID Join Teams ON Teams.TeamID = Injuries.TeamID WHERE"
        Sql += " SportCode ='AB' Order By Injuries.Date DESC"

Open in new window

Any ideas? I had it working then I throw in teams to join on teamid
0
Comment
Question by:powerztom
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
4 Comments
 
LVL 66

Assisted Solution

by:Jim Horn
Jim Horn earned 400 total points
ID: 40422544
Dude, lose the ALL CAPS.

>  Sql += " FROM Injuries Join NFLPlayers np Join Injuries ..
For starters, there are two tables named Injuries, so T-SQL won't be able to tell from which one the columns are coming from.   Alias both of these.
0
 
LVL 75

Expert Comment

by:Aneesh Retnakaran
ID: 40422590
Time to write stored procedures
0
 
LVL 5

Accepted Solution

by:
Jason Schlueter earned 1600 total points
ID: 40422618
Try this.  You have an extra Injuries join.

SELECT Injuries.Name,
       Injuries.Pos,
       Team.Fullname,
       Injuries.Date,
       Injuries.Injury,
       Injuries.Status,
       Injuries.Fantasy,
       Injuries.Type,
       Injuries.TeamID,
       Injuries.PlayerID
FROM   Injuries
       JOIN NFLPlayers np
         ON np.PlayerID = Injuries.PlayerID
       JOIN Teams
         ON Teams.TeamID = Injuries.TeamID
WHERE  SportCode = 'AB'
ORDER  BY Injuries.Date DESC 

Open in new window

0
 

Author Closing Comment

by:powerztom
ID: 40422646
Thanks for writing that one out You sayed me alot of time.Thanks
0

Featured Post

How to Create Failover DNS Record Sets in Route 53

Route 53 has the ability to easily configure DNS record sets specifically for failover scenarios. These failover record sets can be configured to failover to full-blown deployments in other regions or to a static HTML page that informs your customers of the issue.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
In this article we will get to know that how can we recover deleted data if it happens accidently. We really can recover deleted rows if we know the time when data is deleted by using the transaction log.
Video by: ITPro.TV
In this episode Don builds upon the troubleshooting techniques by demonstrating how to properly monitor a vSphere deployment to detect problems before they occur. He begins the show using tools found within the vSphere suite as ends the show demonst…
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…

719 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question