I am trying to join multiple tables and get an output listing. I want to get the last time a memo was modified.
The Code I am currently using is below:
This creates the listing but it does not consistently show the latest mem.modified date, sometimes it does sometimes it doesn't. I would like to keep the GROUP BY b.bid_id for easiness but if that is not possible, then I can change it. I also want to limit only one row per bid_id.
Thank you for your assitance in advance.
if(count($left_a)) {
$left_qtx = implode(' ', $left_a);
}
if(count($where_a)) {
$where_qtx = "WHERE " . implode(' && ', $where_a);
}
$bid_qtx =
"SELECT b.login, b.job_id, b.bid_id, b.step, b.when_sent, b. hosp_notify, ih.name, l.first_name, l.last_name, j.vet_req, mem.sender, mem.modified
FROM jobs_bid AS b
LEFT JOIN jobs_web AS j ON (b.job_id=j.id)
LEFT JOIN info_hosp AS ih ON (j.hosp_id=ih.id)
LEFT JOIN login AS l ON (b.login=l.login)
LEFT JOIN jobs_bid_memo as mem on (b.bid_id=mem.bid_id)
$left_qtx $where_qtx GROUP BY b.bid_id;";