各位老大,每个 user_name 查询最后一条 应该怎么写啊?

2016-07-07 15:47 来源:www.chinab4c.com 作者:ecshop专家

  1. {
  2. $sql = 'SELECT order_sn, user_name,action_note FROM ' . $GLOBALS['ecs']->table('order_info') . ' JOIN (' . $GLOBALS['ecs']->table('users') . ',' .

  3. $GLOBALS['ecs']->table('order_action') . ') ON (' . $GLOBALS['ecs']->table('users') . '.user_id=' . $GLOBALS['ecs']->table('order_info') . '.user_id

  4. AND ' . $GLOBALS['ecs']->table('order_action') . '.order_id=' . $GLOBALS['ecs']->table('order_info') . '.order_id) WHERE ' . $GLOBALS['ecs']->table

  5. ('order_info') . '.shipping_status = 1 ORDER BY shipping_time DESC LIMIT 50';
  6. $postinfo = $GLOBALS['db']->getAll($sql);

  7. clearstatcache();

  8. return $postinfo;
  9. }
复制代码


每个 user_name查询最后一条 应该怎么写啊?