我正在尝试将我的应用程序从 MS SQL Server 移动到 MySQL,并且我LIMIT
在子查询中遇到了 MySQL 子句的问题。
SQL 服务器代码:
select F.call_Id, F.cell_Phone_Number, F.cal_DATE
From TD_Call_Log AS F
Where F.call_Id IN ( Select Top 5 S.call_Id
From TD_Call_Log AS S
where S.cell_Phone_Number = F.cell_Phone_Number)
Order by cell_Phone_Number
我尝试过的 MySQL 代码:
select F.call_Id, F.cell_Phone_Number, F.cal_DATE
From TD_Call_Log F
Where F.call_Id IN (Select S.call_Id
From TD_Call_Log S
where S.cell_Phone_Number = F.cell_Phone_Number Limit 5)
Order by cell_Phone_Number
我也试过:
select F.call_Id, F.cell_Phone_Number, F.cal_DATE
From TD_Call_Log F INNER JOIN (Select S.call_Id
From TD_Call_Log S
where S.cell_Phone_Number = F.cell_Phone_Number Limit 5) as t
ON F.call_Id = t.call_Id
Order by cell_Phone_Number