Symon Turner
Symon Turner

Reputation: 175

Case statment with lesser then in Log parser

I need to write a case statement in Log Parser studio but with a less than clause

I've managed to write the case statment

"Select 
Case time-taken 
when 1000
then 1 else 3
end"

And I have written log parsa with <= as part of the where clause it just won't work when I try and combine them

"Select 
Case time-taken 
when <=1000
then 1 else 3
end"

----- I even tried

"Select 
Case time-taken 
when between 0 and 1000
then 1 else 3
end"

"Select 
Case time-taken 
when 1000
then 1 else 3
end"

Error Parsing Query: syntax error : Cannot find a valid : <=1000 [SQL query syntax invalid or unsupported]

Upvotes: 0

Views: 576

Answers (1)

Tushar A
Tushar A

Reputation: 11

Try something like this:

SELECT cs-uri-stem, stats, COUNT(*)
using
CASE DIV(time-taken, 1000) WHEN 0 THEN 'Less than 1' WHEN 1 THEN 'Less than 2' WHEN 2 THEN 'Less than 3' else 'greater than 3' end as stats
FROM '[LOGFILEPATH]' 
where cs-method = 'POST'
GROUP BY cs-uri-stem, stats
ORDER BY cs-uri-stem, stats

Upvotes: 1

Related Questions