"jim" <ja************ **@yahoo.com> wrote in message
news:11******** **************@ u72g2000cwu.goo glegroups.com.. .
Hi,
I was wondering if anyone out there can help me with this SQL problem:
I have a database that has two tables: EMPLOYEE and JOB_TITLE
The EMPLOYEE Table consists of a salary and job_title _code columns,
among many others; the JOB_TITLE table contains job_title_code column,
among many others.
The SQL problem is: Select the employees' last names and Group them by
Salary within their job_title_code. I am new to SQL statements and
kinda puzzled on how to solve this problem. I would appreciate any help
I can get on this. Thanks a lot in advance.
First, you _do_ mean Access/Jet SQL, don't you? If you are looking for
"generic" SQL or SQL for some other database engine, you'll need to find the
appropriate newsgroup.
Secondly, if it were _my_ class problem, I'd use the Query Builder: Add the
two tables, join them on job_title_code, drag down the Job_Title_Code,
Salary Fields, and Last Name Fields (in that order!). I'd set Sort to
Ascending under Job_Title_Code.
Third, then I would go ask my teacher "Do you really want this Grouped By
salary, so that the Names do not show, or do you really want them Ordered By
salary, so that the Names do show?" If the teacher answers, Yes, I want them
Grouped by salary, then, click View | Totals and set Group By under Salary,
and play around with that. Change to SQL View and copy the SQL to whatever
medium you are submitting the assignement. If the teacher answers, No, I
want them Ordered By Salary, then just set Sort to Ascending under Salary...
Fourth, if it were "real life", I'd assume it meant Order By, and if so, I'd
also Sort by the Last Name, and First Name, both Ascending, as well.
Fifth, see the FAQ at
http://www.mvps.org/access/netiquette.htm: we are not
here to do your homework for you. Consider that you caught me "in a weak
moment," that caused me to do more than we would usually do.
Larry Linson
Microsoft Access MVP
Larry Linson
Microsoft Access MVP