hi,

i need to do a query which joins multiple tables but i need to join the same 2 tables multiple times.

is that possible?

SELECT timeline.TimelineID, timeline.SIPPorCASH, timeline.clients_ClientID, timeline.UserID, timeline.IFAID, timeline.RegionalSalesManager, timeline.AreaSalesManager, timeline.AgencyTradingAgreementSigned, timeline.DateOfClientMeeting, timeline.EstimatedPensionFundAmount, timeline.DateAuthorityMandateSentToIFA, timeline.DetailsOfPensionFunds, timeline.ProductID, timeline.PropertyRef, timeline.NPW, timeline.CaseComplete, clients.ClientID, clients.App1FirstName, clients.App1LastName, clients.App2FirstName, clients.App2LastName, users.UserID, users.FullName
FROM timeline JOIN clients on timeline.clients_ClientID = clients.ClientID join users on timeline.UserID = users.UserID
WHERE timeline.NPW = 0 and timeline.CaseComplete is null and timeline.clients_ClientID = ParamClientID

i need to join timeline.UserID, timeline.IFAID, timeline.RegionalSalesManager, timeline.AreaSalesManager all to users.UserID?

hope someone can help.

many thanks

In your FROM clause you ought to have a different alias name for each instance of users .

thanks for that, so do you mean:

SELECT users.UserID as Agents, users.UserID as IFA

Would that allow me to join the same tables multiple times?

thanks

No, that way you have an alias for the column names, not for the tables.
It must go along the line

SELECT Agents.UserID, IFA.UserID FROM Users As Agents, Users As IFA where ...
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.