Click here to Skip to main content
Rate this: bad
good
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 20:27pm
Edited 6-Oct-12 20:28pm
v2
Comments
Sandip.Nascar at 7-Oct-12 2:51am
   
You question is very vague to give any reply. Please post more specific problem of your issue.
OriginalGriff at 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
0 Sergey Alexandrovich Kryukov 881
1 OriginalGriff 335
2 CPallini 225
3 Volynsky Alex 205
4 Richard Deeming 175
0 OriginalGriff 5,540
1 Sergey Alexandrovich Kryukov 4,668
2 CPallini 4,540
3 George Jonsson 3,102
4 Gihan Liyanage 2,445


Advertise | Privacy | Mobile
Web01 | 2.8.140916.1 | Last Updated 7 Oct 2012
Copyright © CodeProject, 1999-2014
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