The first kind of
Select * from top 1 table where ID in (select the top n ID from the table) order by ID desc;
This could have, but the problem is the top followed by Numbers, can obtain the first n rows of data, but the variable error is
Tip the statement 's size limit if valid
The second
The checked, then found the newid ()
Is said to be in the Select * From TOP 1 TABLE Order By NewID () it can directly get a random data, but tried, found no, testing and data is always the first
I thought for a moment, may be NEWID () the use of the wrong, or other reasons, hope you help to solve it, or don't have other method for the random data,
Premise is not data window, this also has some reasons, first thanked everyone ha,,
CodePudding user response:
Long ll_idSelect top 1 id into: ll_id from my table or view the order by newid ();
Through, and every time is different.
You use * INTO where to go?
Or in the DW?
DW also had better don't use *, modified since it is difficult to check.
CodePudding user response:
Select * From TOP 1 TABLE Order By NewID () is a random dataCodePudding user response:
Select TOP 1 * From TABLE Order By NewID ()
This should be randomly pick up a number of lines, you there are other causes of
CodePudding user response:
Table structure is how to define the table structure of the problem, I just tried, still won't do, or show only the first