select max(a.id),a.userid from a,b where a.userid = b.userid;
select max(table1.id),table1.userID from table1 left join table2 on table1.userID = table2.userID where ... group by table1.userID
select max(table1.id),table1.userID from table1 left join table2 on table1.userID = table2.userID where ... group by table1.userID 好像用这条SQL语句查出来的只是主表和子表的其中一条ID最小的记录,而我要的是子表中ID最大的记录!
好像用这条SQL语句查出来的只是主表和子表的其中一条ID最小的记录,而我要的是子表中ID最大的记录!