[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: more help with SELECT statement


Hi,


A few days ago, I asked the list about a SELECT statement. I received 2 replies that didn't really work but helped me think about the problem some more. In my database I have 4 tables. For this one query, I am matching up data from 3 of these tables and then displaying them on a website.

Here is the query:

SELECT request.id, request.date, request.type, request.status,
faculty.f_name, faculty.l_name, action.id, faculty.id FROM faculty, request LEFT JOIN action ON request.id=action.request_id WHERE request.requested_by=faculty.id;

and here is the output created by a php script with data from the above query:

http://www.geology.ohio-state.edu/test/rfatest/rfadisplay.php


I know it looks ok, but I am not quite sure the SELECT statement is doing what I want it to. I want the query to match up all the requests(request) with the person who requested them(faculty) and then match up all the requests to any actions that our staff might have performed on them (action). However, if no actions were performed yet, I still need those requests displayed. So basically I am matching up one table with two other tables.

So if any one can examine the above SELECT statement, and let me know if it does/doesn't look ok, then that would be great.

Thanks,
Chris

Looks good from my porch.

Bob Hall

Know thyself? Absurd direction!
Bubbles bear no introspection.     -Khushhal Khan Khatak

---------------------------------------------------------------------
Before posting, please check:
  http://www.mysql.com/manual.php   (the manual)
  http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <mysql-thread67421@xxxxxxxxxxxxxxx>
To unsubscribe, e-mail <mysql-unsubscribe-treed=ultraviolet.org@xxxxxxxxxxxxxxx>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php



This mailing list archive is a service of Copilot Consulting.