user3714403
user3714403

Reputation: 101

how to fetch all rows in u-sql in data lake in order by clause

While writing u-sql query I am using Order by clause FETCH clause is necessary to use but what should I write if don't want to fetch limited number of rows but all rows from rowsets. Thanks for help

Upvotes: 2

Views: 1446

Answers (3)

K.L Sathish
K.L Sathish

Reputation: 51

SELECT A.aa, A.bb FROM @rowset AS A ORDER BY A.your_column OFFSET 0 ROWS;

select * some tie wont work.. we will use all columns

Upvotes: 0

WongSSJ
WongSSJ

Reputation: 1

This was not available at the time the question was asked, but you can try:

SELECT *
FROM @rowset
ORDER BY your_column OFFSET 0 ROWS;

Upvotes: 0

Akash
Akash

Reputation: 1726

Since rowsets are unordered by definition, you should put the ORDER BY command when writing the final result to the output file

Syntax from the documentation:

OUTPUT @res
    TO "/output/Searchlog-having.csv"
    ORDER BY TotalDuration DESC
    USING Outputters.Csv();

https://azure.microsoft.com/en-in/documentation/articles/data-lake-analytics-u-sql-get-started/

The ORDER BY in SELECT is relevant only when you're picking a subset of rows i.e. when you have a LIMIT clause

Upvotes: 4

Related Questions