Click here to Skip to main content
12,699,898 members (35,573 online)
Rate this:
 
Please Sign up or sign in to vote.
See more: SQL Access
Hii everyone,

in sql statement i need to add fildes from query that does not include in this form

SELECT tblPersonnel.EmpKey,tblPersonnel.amount_paid,tblPersonnel.amount_required,tblPersonne.amount_rest,tblPersonnel.Bus,tblPersonnel.Employee, tblPersonnel.LastName, tblPersonnel.FirstName, tblPersonnel.MiddleName, tblPersonnel.Shift, tblPersonnel.JobTitle, tblPersonnel.Department,tblPersonnel.HireDate, tblPersonnel.StartDate, tblPersonnel.BirthDate, tblPersonnel.Current, tblPersonnel.WorkStatus, tblPersonnel.Photo, tblAddresses.Address1,tblAddresses.Address2, tblAddresses.City, tblAddresses.State, tblAddresses.ZIP, tblAddresses.HomePhone, tblAddresses.WorkPhone, tblAddresses.CellPager, tblAddresses.EMail, tblNumber.SSN, tblEEOCData.Gender, tblEEOCData.Race, tblEEOCData.Veteran, tblEEOCData.Handicap FROM ((tblDepartments RIGHT JOIN ((tblPersonnel LEFT JOIN tblEEOCData ON tblPersonnel.EmpKey = tblEEOCData.EmpKey) LEFT JOIN tblNumber ON tblPersonnel.EmpKey = tblNumber.EmpKey) ON tblDepartments.DeptNo = tblPersonnel.Department) LEFT JOIN tblAddresses ON tblPersonnel.EmpKey = tblAddresses.EmpKey) LEFT JOIN tblPastEmployees ON tblPersonnel.EmpKey = tblPastEmployees.EmpKey;
Posted 6-Oct-12 21:27pm
Updated 6-Oct-12 21:28pm
v2
Comments
Sandip.Nascar 7-Oct-12 2:51am
   
You question is very vague to give any reply. Please post more specific problem of your issue.
OriginalGriff 7-Oct-12 3:08am
   
This is not a good question - we cannot work out from that little what you are trying to do.
Remember that we can't see your screen, access your HDD, or read your mind.
Use the "Improve question" widget to edit your question and provide better information.

1 solution

Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 1

The above query can't works, because of wrong table name: tblPersonne.amount_rest - missed "l".

Try to use aliases[^], for example:
SELECT P.EmpKey, P.amount_paid, P.amount_required, P.amount_rest, P.Bus, P.Employee, P.LastName, P.FirstName, P.MiddleName,
    P.Shift, P.JobTitle, P.Department,P.HireDate, P.StartDate, P.BirthDate, P.Current, P.WorkStatus, P.Photo,
    A.Address1,A.Address2, A.City, A.State, A.ZIP, A.HomePhone, A.WorkPhone, A.CellPager, A.EMail, N.SSN,
    D.Gender, D.Race, D.Veteran, D.Handicap
FROM ((tblDepartments RIGHT JOIN ((tblPersonnel AS P LEFT JOIN tblEEOCData AS D ON P.EmpKey = D.EmpKey)
    LEFT JOIN tblNumber AS N ON P.EmpKey = N.EmpKey) ON tblDepartments.DeptNo = P.Department)
    LEFT JOIN tblAddresses AS A ON P.EmpKey = A.EmpKey)
    LEFT JOIN tblPastEmployees ON P.EmpKey = tblPastEmployees.EmpKey;


Finally i have a question: What's this for?
LEFT JOIN tblPastEmployees ON P.EmpKey = tblPastEmployees.EmpKey
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy | Mobile
Web02 | 2.8.170118.1 | Last Updated 7 Oct 2012
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100