Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SQL coding help

Status
Not open for further replies.

l3reacher

Technical User
Jun 28, 2003
83
US
Hi, I tried doingthis code but it doesn't let me because of syntax error. How can I make this work, cuz I want to use two tables into one query so that I can use it in the reports.

SELECT A.FirstName, A.LastName, Count(A.Classes) AS CountOfClasses, First(A.Title2) AS FirstOfTitle2
FROM Training AS A
GROUP BY A.FirstName, A.LastName
ORDER BY A.LastName
AND
SELECT [Employees Contact Information].Title, [Employees Contact Information].EmployeeID, TrainingClasses.Classes, TrainingClasses.[Other Classes]
FROM [Employees Contact Information] RIGHT JOIN TrainingClasses ON [Employees Contact Information].EmployeeID = TrainingClasses.EmployeesID;


I Hate Spammers and Flammers!!!
 
Or is there in possibility to bound two queries into one report instead of one query. If it's possible, then I don't need two create two tables into one query.

I Hate Spammers and Flammers!!!
 
What are you trying to accomplish?

Looks like you have

TABLE: Training

FIELDS: FirstName, LastName, Classes, Title2

TABLE: EMPLOYEES CONTACT INFORMATION

FIELDS: Title, EmployeeID

TABLE: TRAININGCLASSES

FIELDS: EmployeesID, Classes, Other Classes,

So, my first question is why do you have FirstName and LastName in Training rather than the employeeID? Secondly, are you trying to come up with a report that lists all the training that each employee did? Is trainingClasses the many to many table between TRAINING and EMPLOYEES? and finally what do you want your query results to look like?



Leslie
 
Actually, I figured out how to do it... :) Well what I wanted to do is to count the number of a Specific title, from training from text. And within the Employee Contact Information, I needed to find who is in the title and stuff. Then with all these, I had to put it into a report. Well, actually it's hard to explain, but i already figured out how to do it. Thanks anyways... :)

I Hate Spammers and Flammers!!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top