A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » General Discussion
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Please help to give outer join instead of inner join



 
 
Thread Tools Display Modes
  #1  
Old May 19th, 2010, 02:25 PM posted to microsoft.public.access
pol[_2_]
external usenet poster
 
Posts: 178
Default Please help to give outer join instead of inner join

I want to list all the employees from employee eventhough not existing in
holiday

SELECT
employee.company,
employee.recordid,
employee.employee,
employee.holsallow,
employee.hrs_holiday,
Holiday.datefrom,
Holiday.dateto,
Holiday.descr,
Holiday.ho_hrs,
Holiday.ho_mts,
FROM employee,
Holiday
WHERE ( Holiday.employeeid = employee.recordid )
order by Holiday.employeeid, Holiday.datefrom

Please help

With thanks
Pol


  #2  
Old May 19th, 2010, 03:02 PM posted to microsoft.public.access
PsyberFox
external usenet poster
 
Posts: 88
Default Please help to give outer join instead of inner join

Hi pol,

What i would normally do is change the FROM statement to the following:

FROM employee left join
holiday on Holiday.employeeid = employee.recordid

and obviously drop this from the WHERE statement

Hope this helps...
W

--
The Psyber Fox
http://www.psyberconsulting.co.za


"pol" wrote:

I want to list all the employees from employee eventhough not existing in
holiday

SELECT
employee.company,
employee.recordid,
employee.employee,
employee.holsallow,
employee.hrs_holiday,
Holiday.datefrom,
Holiday.dateto,
Holiday.descr,
Holiday.ho_hrs,
Holiday.ho_mts,
FROM employee,
Holiday
WHERE ( Holiday.employeeid = employee.recordid )
order by Holiday.employeeid, Holiday.datefrom

Please help

With thanks
Pol


  #3  
Old May 19th, 2010, 03:19 PM posted to microsoft.public.access
John Spencer
external usenet poster
 
Posts: 7,815
Default Please help to give outer join instead of inner join

SELECT
employee.company,
employee.recordid,
employee.employee,
employee.holsallow,
employee.hrs_holiday,
Holiday.datefrom,
Holiday.dateto,
Holiday.descr,
Holiday.ho_hrs,
Holiday.ho_mts,
FROM employee LEFT JOIN Holiday
ON (Holiday.employeeid = employee.recordid )
ORDER BY Holiday.employeeid, Holiday.datefrom

OR you might try the following

SELECT
employee.company,
employee.recordid,
employee.employee,
employee.holsallow,
employee.hrs_holiday,
Holiday.datefrom,
Holiday.dateto,
Holiday.descr,
Holiday.ho_hrs,
Holiday.ho_mts,
FROM employee,
Holiday
WHERE Holiday.employeeid = employee.recordid
OR employee.recordid is Not Null
order by Holiday.employeeid, Holiday.datefrom

John Spencer
Access MVP 2002-2005, 2007-2010
The Hilltop Institute
University of Maryland Baltimore County

pol wrote:
I want to list all the employees from employee eventhough not existing in
holiday

SELECT
employee.company,
employee.recordid,
employee.employee,
employee.holsallow,
employee.hrs_holiday,
Holiday.datefrom,
Holiday.dateto,
Holiday.descr,
Holiday.ho_hrs,
Holiday.ho_mts,
FROM employee,
Holiday
WHERE ( Holiday.employeeid = employee.recordid )
order by Holiday.employeeid, Holiday.datefrom

Please help

With thanks
Pol


 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 06:51 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.