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?

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)

Thank you smantscheff !
Thanks so much for your help!
(:

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.