Solved

3 JOIN QUERY AGAIN

Posted on 2014-11-04
4
131 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
4 Comments
 
LVL 65

Assisted Solution

by:Jim Horn
Jim Horn earned 100 total points
Comment Utility
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
Comment Utility
Time to write stored procedures
0
 
LVL 5

Accepted Solution

by:
Jason Schlueter earned 400 total points
Comment Utility
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
Comment Utility
Thanks for writing that one out You sayed me alot of time.Thanks
0

Featured Post

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (http://www.ecb.europa.eu/stats/exch…
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 tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

744 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now