This is a discussion on Re: Outer Joining Multiple Tables within the MySQL Database forums, part of the Database Forums category; On Jan 8, 3:37 am, "Paul Lautman" <paul.laut...@btinternet.com> wrote: > DonO wrote: &...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
On Jan 8, 3:37 am, "Paul Lautman" <paul.laut...@btinternet.com> wrote:
> DonO wrote: > > Ok. I'll try to explain better... > > > This will work to get everyone who is in the system: > > > SELECT signoff.item_name, user.first_name, user.last_name, > > completed.date_complete > > FROM signoff > > JOIN completed ON completed.signoff_uid = signoff.uid > > JOIN user ON user.uid = complete.user_uid > > WHERE signoff.uid = '1' ; > > > That gets me the name off the required signoff, the user's name, and > > the date they signed off. > > > I'd like to list all the employee's that have not signed off too with > > a NULL for the date_complete. > > > Thanks, > > D. > > Please do not top post. > > Can you supply some context for these tables? > What is signoff.item_name? > What is the significance of signoff.uid = '1'? > If the above query gets "everyone who is in the system", how can there be > more employees (note no apostrophe) to get? Sorry about the top post. I was able to figure it out. You helped by slapping my hand on how I did the joins ;-) The "real" tables I have set up are EMPLOYEE, ACKNOWLEDGEMENT, and EMPLOYEE_ACKNOWLEDGEMENT. The purpose of the system is to set up a policy employees must sign off on. Not everyone has to sign off on every policy though. What I ended up doing is selecting all employee's, then left outer joining the EMPLOYEE_ACKNOWLEDGEMENT table, and then a regular join to ACKNOWLEDGEMENT table. It lists all employees, and if they are set up, it will show the status. If not, then I have the option to select a checkbox and submit the list of IDs to add. Anyhow... I appreciate you trying to help. It enabled me to figure it out quicker! D. |