我希望能够从数据库的内部选择中订购列表。我的代码:
$sql = "SELECT * from `users` WHERE `name` in (select `last` from info where `date` = '2013' ORDER BY `id` DESC)";
我希望能够从表last
而不是users
获取订单。
答案 0 :(得分:1)
试试这个,
使用JOIN
查询
$sql = "SELECT u.* from `users` u JOIN `info` i ON u.name = i.last WHERE i.date = '2013' ORDER BY i.id DESC";