Solved

3 JOIN QUERY AGAIN

Posted on 2014-11-04
4
134 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
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 400 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Help with sorting data in Listbox using VB.NET 3 53
vb.net checkbox 7 41
VB.Net How to Exit Sub - Exit Form??? 5 50
Get Client IP on RDS - VB.NET 15 25
More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
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.
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

911 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

26 Experts available now in Live!

Get 1:1 Help Now