Page is a not externally linkable
noyearzero - 3:02 pm on Jun 19, 2012 (gmt 0)
I'm not sure if this is exactly right....but it should put you on the path. (replace `tbl_access_log.id` with the actual primary index for the table `tbl_access_log`)
SELECT
tbl_access_log.fld_login,
tbl_access_log.fld_logout,
tbl_admin_user.*
FROM tbl_admin_users
LEFT JOIN tbl_access_log ON tbl_access_log.id = (
SELECT
tbl_access_log.id
FROM tbl_access_log
WHERE
tbl_access_log.fld_user_id = '" . $adminId . "'
ORDER BY
tbl_access_log.fld_logout DESC
LIMIT 1
)
Additionally, if your $adminId variable actually refers to the current row in the outer table (tbl_admin_users) you could replace
'" . $adminId . "'
with
tbl_admin_users.fld_user_id
(assuming fld_user_id is the name of the same field)
That would be more appropriate if your outer table is meant to pull back more than 1 row