SQL Server数据库里面是用TOP关键字 例如: SELECT TOP N * FROM TABLE1
MySQL里面是用limit 例如: SELECT * FROM TABLE1 LIMIT N
结果发现 MySQL的limit不可以放到IN()里面,而SQL Server可以。
SELECT * FROM Road WHERE RoadId IN (SELECT TOP " + roadNum + " RoadId FROM BusRoad WHERE BusId = '" + bus.BusId + "' ORDER BY Sequence ASC)
--转自