Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Where Statement

I am doing analysis on a web log. The fields I have are:

UserName,

TimeStamp,

Action,

SessionID (Identifier that tracks an active session)

Before a user logs in, we track their UserName as 'NA' and when they log in their UserName switches to their actual login name. However, we also run scripts to test are servers that are also stored with the UserName 'NA'. Could you guys help me come up with the Where statement that would include the UserName 'NA' when there is another UserName within that SessionID and eliminate the UserNames 'NA' when it is the only UserName in that SessionID?

Thanks in advance,

Eric

2 Replies
Jason_Michaelides
Luminary Alumni
Luminary Alumni

Can you provide some sample data and required output?

rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

Best guess without sample data.

QualifiedSessions:

LOAD SessionId

where UseridCount>1

;

LOAD

      SessionId,

     count(UserName) as UseridCount

FROM weblogs

GROUP by SessionId

;

SessionLogs:

LOAD *

FROM weblogs

WHERE exists(SessionId)

;

DROP TABLE QualifiedSessions;

-Rob

http://robwunderlich.com