SELECT realname AS name, tel AS tel, (SELECT daname FROM `allset` WHERE `to` = a.KEY AND allset.del=0 ORDER BY allset.id DESC LIMIT 0,1) AS dnam, (SELECT times FROM `allset ` WHERE `to` = a. KEY AND allset.del=0 ORDER BY allset.id DESC LIMIT 0,1) AS TIME FROM student a WHERE KEY = '1234'