0

dear all

i have 2 tables, one is project table and another replies table.

"SELECT * FROM project, replies WHERE replies.member_id=$_SESSION[member_id] 
AND project.project_id=replies.project_id ORDER BY project.project_id ";

the above code gives me all , but I need the latest updated replied in each project id
I tried

SELECT * FROM project INNER JOIN replies ON  project.project_id=replies.project_id 
 WHERE replies.member_id=$_SESSION[member_id] GROUP BY replies.project_id ORDER BY project.project_id ";

it gives me the unique project id however it does now show the latest trainer replies. I have a date column in database does it helps?

2
Contributors
2
Replies
3
Views
5 Years
Discussion Span
Last Post by qwertpink
0
select * from project p, replies r
where p.project_id=r.project_id
and
r.mydate = (select max(mydate) from replies rr where rr.project_id=p.project_id group by project_id)
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.