Please help me with my Query

  • Thread starter Thread starter DaveSundo9000
  • Start date Start date
D

DaveSundo9000

Guest
Hello All,

Basically I would like to query both the first name of ReportToID and AssignedToID from the table Users (Please see below for simple table structure)

If I use this sql which is "Select FirstName from Users, Tracking where Tracking.ReportToID=UsersID and Tracking.AssignedToID=UserID", I will get output only the firstname from AssignedToID. How can I do a single select statement to get both First Name from ReportToID and AssignedToID? Would it possible?

Greatly appreciated for any feedbacks!

Thanks a bunch,
Dave Sundo


-------------------------------------------------
Table Name: Users
ColumnName: UserID (int)
Column Name: FirstName (text)
Column Name: LastName (text)
-------------------------------------------------
Table Name: Tracking
Column Name: ReportToID (int)
Column Name: AssignedToID (int)
In this table, The ReportToID and AssignedToID value are using the "UserID"
defined from the UserID in Users table.
 
tblUsers
UserID (autonumber - long) PK
FirstName (text)
LastName (text)

tblTracking
ReportID (long)
UserID (long)

tblReports
ReportID - (autonumber - long) PK
RepName - Text

Code:
Select tblusers.firstname, tblusers.lastname, tblReports.RepName
From 
(tblTracking left join tblUsers on tbltracking.userid=tblUsers.userid)
left join tblReports on tblTracking.ReportID=tblReports.ReportID

Try that?


Vince
 

Users who are viewing this thread

Back
Top Bottom