View Single Post
Old 02-11-2008   #1 (permalink)
jayemsee283
Registered User
 
Join Date: Feb 2008
Posts: 2

New to PHP, confused with LEFT JOIN

Hi all. I really love your site...and have learned a good bit from tutorials provided!

I am trying to write a program addition to an application we currently are using. What it needs to do is this in each row:

Display all users name
Show all users total points per category
Show all their total overall points



MySQL info:


The "points" table has a column (points) which is where each entry of points is stored..nothing major there. It also has a column (user_id) which corresponds with the "user" table to get the users (char_name). The "points" table also has and a (custom_event_id) which matches the (point_cat_description_id) of the "point_cat_description" table to get the (name).


I am having headaches over this because I know my answer is simple...I just can't get it right. The SQL query that I have is:

Quote:
SELECT points, user_id, custom_event_id FROM points
LEFT JOIN user ON points.used_id=user.user_id
LEFT JOIN point_cat_description ON points.custom_event_id=point_cat_description.point _cat_description_id
I think the query is right...or close...I just don't know how to get the values that I need from joining the tables...

Another small problem I am having is deciding if I am going to use a for or do...while loop to display the data (leaning towards a for).

I REALLY appreciate ANY and ALL help, and thank you for helping in advance !
jayemsee283 is offline   Reply With Quote