Skip to content
Advertisement

SQL How to flag a given sessionID based on values from another column

Forgive me I’m not massively familiar with SQL to do the below. But would love to learn the process of how to do it if possible.

I only have one table: Table name – SessionTracker

I’d like to

From the example above:

I want to check is if a session which consists of request, event & response has a different value in one of each. Like the sessionId above (3871207406642403679) the code value is 1 in each so this wouldn’t be flagged.

The second sessionId (3245233406642403679) the code value in one of the request, event & response has the code value 2 for event and response, so this would be flagged.

I’m hoping a query in databricks would work, is this possible?

Advertisement

Answer

In SQL, you could do this with aggregation and a having clause:

This gives you all sessionIds that have at least two distinct codeValues.

User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement