I want to select distinct values from posts.
In the posts table there are:
pst_id - this is the post id for each posted item.
mem_id - this is the member id.
top_id - this is the topic id that the post (pst_id) is under.
posted this is the time the post (pst_id) was posted.
I have no problem with this part (However i suspect i need to GROUP BY rather then DISTINCT)
$query = "SELECT DISTINCT pst_id, mem_id, posted FROM posts ORDER BY posts.posted DESC LIMIT 0, 10";
Latest Forum Posts
Author - Title - Time
100002 100003 8:14 am
100003 100002 5:12 am
100003 100001 5:04 am
100000 100000 8:59 pm
Now heres the part I cant seem to do. I want the Author values (10002 etc&) to look in the members table and output the persons name rather than their 'mem_id'.
The members table looks like this:
and I want the Title value (10003 etc&) to look in the topics table and output the topic subject title.
The topics table looks like this:
subject: Do you like the color blue?
subject: Do you like the color red?
I am able to output this from the database without using using DISTINCT. But I only want one subject to show.
If I forgot any info please let me know as this is my first posting.
Thanks for your help!