1

我有以下“活动记录”设置:

$this->db->select('*');
$this->db->from('Orders');
$this->db->join('MPC_Agents', 'Orders.UserName = MPC_Agents.UserName', 'inner');    
$this->db->limit(50,20);
$query = $this->db->get();

使用$this->db->last_query();mereley 输出:

SELECT * FROM (Orders) INNER JOIN MPC_Agents ON Orders.UserName = MPC_Agents.UserName

为什么不应用限制?

4

2 回答 2

1

限制在 MS Access SQL 中不可用。您可以选择顶部:

SELECT Top 10 Id FROM Table Order BY Id

或者

SELECT Top 10 Id FROM Table 
WHERE ID Not IN (SELECT Top 10 ID From Table ORDER BY Id)
Order BY Id
于 2012-07-18T14:36:16.790 回答
0

将您的极限乐趣放在查询顶部并编辑为

 $this->db->limit(20,50);
 $this->db->select('*');
 $this->db->from('Orders');
 $this->db->join('MPC_Agents', 'Orders.UserName = MPC_Agents.UserName', 'inner');
 $this->db->get();

希望效果更好

于 2012-08-21T12:21:51.483 回答