MS Access Query Issue .

firoz.raj

Registered User.
Local time
Today, 17:56
Joined
Dec 4, 2008
Messages
41
I Have Two table Employees and Salary !!!. I Want to see the following output using query .

ID NAME SALARY
3 C
4 D

I have written the sql query .but i did not get the in the following order. I want to get in the following order .
.The query needs to return
ID NAME SALARY
3 C
4 D
here is the following MS Access query .but i did not get the above results .let me know please .any help would be highly appreciated.
Code:
SELECT Employees.ID, Employees.Name, Salary.Salary
FROM Employees RIGHT JOIN Salary ON Employees.ID=Salary.ID;
 

Attachments

If you only want to see the salaries for employees A & E then your query should look like;
Code:
SELECT Employees.ID, Employees.Name, Salary.Salary
FROM Employees RIGHT JOIN Salary ON Employees.ID = Salary.ID
WHERE (((Employees.Name)="A")) OR (((Employees.Name)="E"));
 
Last edited:
Still not working .the query needs to give the output like the following !!!.Let me know the idea .
Code:
ID                NAME                  SALARY
3                   C                    
4                   D
 
Well your Salary Table holds no data for employees C or D.

You also might want to consider implementing a naming protocol such as TBL_TableName, FRM_FormName, QRY_QueryName, RPT_ReportName etc. limit your self to alpha and numeric charters and the underscore.
 
Still i did not get the query result of employee id 3 and employees id 4.in the following order .Simple i want to get the Name and Salary of Employee ID =3 and Employee ID= 4 .
Code:
SELECT Employees.ID, Employees.Name, Salary.Salary
FROM Employees RIGHT JOIN Salary ON Employees.ID=Salary.ID
WHERE (((Employees.ID)=3)) And (((Employees.ID)=4));
 

Attachments

Still i did not get the query result of employee id 3 and employees id 4.in the following order .Simple i want to get the Name and Salary of Employee 3 and Employee 4 .
Code:
SELECT Employees.ID, Employees.Name, Salary.Salary
FROM Employees RIGHT JOIN Salary ON Employees.ID=Salary.ID
WHERE (((Employees.ID)=3)) And (((Employees.ID)=4));

That's because your Salary table hold no data to return against either of those ID's, you need to enter a salary for both those employees.
 
Still Not Working .here is the following Sql Query .What i have written .let me know please .
Code:
ELECT Employees.ID, Employees.Name, Salary.Salary
FROM Employees RIGHT JOIN Salary ON Employees.ID=Salary.ID
WHERE (((Employees.Salary)=Null)) ;
 

Attachments

You still have no data in your Salary table for either of those employees.

This would seem to me, to be a very irregular situation as even a new employee, should have a pay rate assigned to them.
 
You still have no data in your Salary table for either of those employees.

This would seem to me, to be a very irregular situation as even a new employee, should have a pay rate assigned to them.
Code:
yes salary for Employee id 3 and 4 is null.But why it is not comming on the basis of Null !!!
SELECT Employees.ID, Employees.Name, Salary.Salary
FROM Employees RIGHT JOIN Salary ON Employees.ID=Salary.ID
WHERE (((Employees.Salary)=Null));
 
You need to think about this logically. If you have no records in your Salaries table, matching an ID in your employee table, how can your employee table join to your salaries table if there is nothing to join on?
 

Users who are viewing this thread

Back
Top Bottom