且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何编写(MySQL)"LIMIT"在SQL Server中?

更新时间:2023-10-06 12:19:28

LIMIT在T-SQL中不起作用.

LIMIT does not work in T-SQL.

您必须改为使用TOP,例如:

You have to use TOP instead, like this:

SELECT TOP(1) * FROM tableEating WHERE person='$identity';

我希望这对您有用.

正如亚伦所说,如果您不想获得任意行,还需要一个ORDER BY.

As Aaron says, you also need an ORDER BY if you don't want to get an arbitrary row.