Goozak
Goozak

Reputation: 529

ORDER BY with multiple column in different directions (ASC & DESC)

Not sure if my issue is with Log Parser itself, or with Log Parser Studio...

Trying to run something like this in LPS interface:

SELECT cs-uri-query, TO_LOCALTIME(TO_TIMESTAMP(date, time)) AS fullTime
FROM  '[LOGFILEPATH]'
ORDER BY cs-uri-query ASC, fullTime DESC

but I get:

Error parsing query: Syntax Error: extra token(s) after query: ','
[SQL query syntax invalid or unsupported.]

If I remove ASC, query goes thru, but column cs-uri-query is also sorted in descending order:

src=web  08/08/18 05:55:29
src=web  07/08/18 10:44:43
src=web  07/08/18 03:55:16

src=rss  08/08/18 03:40:59
src=rss  08/08/18 03:40:17
src=rss  07/08/18 04:30:37

src=eml  09/08/18 09:49:51
src=eml  09/08/18 08:13:01
src=eml  09/08/18 07:55:58

Is there a way to use ORDER BY with two columns sorted in different directions?

src=eml  09/08/18 09:49:51
src=eml  09/08/18 08:13:01
src=eml  09/08/18 07:55:58

src=rss  08/08/18 03:40:59
src=rss  08/08/18 03:40:17
src=rss  07/08/18 04:30:37

src=web  08/08/18 05:55:29
src=web  07/08/18 10:44:43
src=web  07/08/18 03:55:16

Upvotes: 0

Views: 1122

Answers (1)

Goozak
Goozak

Reputation: 529

Turns out the help file has the answer :

Tip: Differently than the standard SQL language, the Log Parser SQL-Like language supports only one DESC or ASC keyword for the whole ORDER BY clause.

So, RTFM :-)

Upvotes: 2

Related Questions