Solved

Ref-Ontana request for code(Unable to get Ontanas EMAIL)

Posted on 2001-07-30
8
185 Views
Last Modified: 2010-05-02
SELECT Sal_Mas.Emp_No, Sal_Mas.Emp_SurName, transfile.tran_empno, transfile.SalaryAdv, Sal_Mas.Emp_Basicsal, Sal_Mas.Allow1, Sal_Mas.Allow2, Sal_Mas.Allow3, Sal_Mas.Allow4, Sal_Mas.Allow5, Sal_Mas.Allow6, Sal_Mas.Allow7, Sal_Mas.Allow8, Sal_Mas.InterimAllow, transfile.Festadv, transfile.Lunch, transfile.StaffPfContr, transfile.Loan, transfile.CollegePFLoan, transfile.Paye, transfile.SundryDed,


FROM Sal_Mas, transfile WHERE
 Sal_Mas.Emp_No = transfile.tran_empno

UNABLE TO GET ALL TRANSACTIONS FROM MASTERFILE PLS HELP ME WITH THE CODE

MASTER FILE IS sal_mas
0
Comment
Question by:josephrrc
8 Comments
 
LVL 69

Expert Comment

by:Éric Moreau
Comment Utility
You need a LEFT JOIN:

SELECT Sal_Mas.Emp_No, Sal_Mas.Emp_SurName, transfile.tran_empno, transfile.SalaryAdv, Sal_Mas.Emp_Basicsal,
Sal_Mas.Allow1, Sal_Mas.Allow2, Sal_Mas.Allow3, Sal_Mas.Allow4, Sal_Mas.Allow5, Sal_Mas.Allow6, Sal_Mas.Allow7,
Sal_Mas.Allow8, Sal_Mas.InterimAllow, transfile.Festadv, transfile.Lunch, transfile.StaffPfContr, transfile.Loan,
transfile.CollegePFLoan, transfile.Paye, transfile.SundryDed


FROM Sal_Mas
LEFT OUTER JOIN transfile
ON Sal_Mas.Emp_No = transfile.tran_empno
0
 
LVL 1

Accepted Solution

by:
alaplume earned 50 total points
Comment Utility
The extra comma after transfile.SundryDed would be one problem.
0
 
LVL 1

Expert Comment

by:loveneesh_bansal
Comment Utility
Hi the answer is so simple you have done every thing right but if you go once agin from your query you will find that in the select statement (before the where clause) you didnot mention the "transfile.tran_empno" field.

The right query shoul be like


SELECT Sal_Mas.Emp_No, Sal_Mas.Emp_SurName, transfile.tran_empno, transfile.SalaryAdv, Sal_Mas.Emp_Basicsal,
Sal_Mas.Allow1, Sal_Mas.Allow2, Sal_Mas.Allow3, Sal_Mas.Allow4, Sal_Mas.Allow5, Sal_Mas.Allow6, Sal_Mas.Allow7,
Sal_Mas.Allow8, Sal_Mas.InterimAllow,transfile.tran_empno, transfile.Festadv, transfile.Lunch, transfile.StaffPfContr, transfile.Loan,
transfile.CollegePFLoan, transfile.Paye, transfile.SundryDed,


FROM Sal_Mas, transfile WHERE
Sal_Mas.Emp_No = transfile.tran_empno


i know now the program will definately work.


Bye
Loveneesh

0
 
LVL 11

Expert Comment

by:Otana
Comment Utility
actually, the transfile.tran_empno field WAS already in the query.

Not that it matters if it wasn't, because it's perfectly possible to put a field in the WHERE clause which you have not selected.

But on the topic: Emoreau is right. With a left join you get all records in the first table, linked to their corresponding fields in the other table or a NULL-record where there are no corresponding records.

Hope it helped, :)
0
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 

Author Comment

by:josephrrc
Comment Utility
Thanks to all u nice guys my payroll prg is now working fine.Thanks alot may be any more problems I shall come back again to all u computer wizards
Cheers,
Josephrrc
0
 

Author Comment

by:josephrrc
Comment Utility
Thanks to all u nice guys my payroll prg is now working fine.Thanks alot may be any more problems I shall come back again to all u computer wizards
Cheers,
Josephrrc
0
 
LVL 69

Expert Comment

by:Éric Moreau
Comment Utility
You need to accept one of the comment now!
0
 

Author Comment

by:josephrrc
Comment Utility
Now the prg is working thanks lot
cheers
0

Featured Post

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now