Is my subquery inneficient. It is extremely slow I have two tables. Member information and login entries. I am simply trying to display the member information table sorted by the last login access date.  So i created this query, but it is extremely slow. Is there a better way to write it?

SELECT
    menmembers.memb_id, 
    menmembers.firstname, 
    menmembers.lastname, 
    (SELECT Max(trank.datetr) AS MaxOfdatetr
        FROM trank 
        where trank.cod_usr=menmembers.memb_id;) AS LastLogin
FROM menmembers;
Your query is slow because of the sub-select.  It is what is known as a correlated sub query.  It will be executed once per row in the outer query.

This question answers a similar problem.  It's looking for the minimum, you for the maximum; it's using one table, you're using one.  The translation shouldn't be too hard, though.