Document toolboxDocument toolbox

LINQ query examples

Here we provide some examples using the default demo.ecommerce.data table. After opening the data table, you can copy and paste these queries into the Query code editor to run them on the table and see the results. All the information about the available operations and how to add them to your LINQ query script is found here.  

  • Filter for records with GET in the method column: 
    from demo.ecommerce.data
    where method = "GET"

  • Filter for records with GET in the method column and where the clientIpAddress value is 176.185.139.21:
    from demo.ecommerce.data
    where method = "GET"
    clientIpAddress = 176.185.139.21

  • For each 10 minute interval, filter for records where statusCode is 404, displaying the method and clientIpAddress values:
    from demo.ecommerce.data
    where statusCode = 404
    Group every 10m by method, clientIpAddress
    every 10m

  • Same as the previous query but adding the myCountColumn that shows the count of records in the interval with the same clientIPAddress and method values: 
    from demo.ecommerce.data
    where statusCode = 404
    group every 10m by method, clientIpAddress
    every 10m
    select count() as myCountColumn

  • Same as the previous query but adding the myAverage column that shows the average of the timeTaken value of matching records during the interval: 
    from demo.ecommerce.data
    where statusCode = 404
    group every 10m by method, clientIpAddress
    select count() as myCountColumn
    select avg(timeTaken) as myAverage

  • Add two new columns to the table, latitude and longitude, based on the clientIpAddress:
    from demo.ecommerce.data
    select mmlatitude(clientIpAddress) as latitude
    mmlongitude(clientIpAddress) as longitude

  • Same as the previous query but adding the count column that shows count of the number of connections per latitude and longitude by 30-minute intervals:
    from demo.ecommerce.data
    select mmlatitude(clientIpAddress) as latitude
    select mmlongitude(clientIpAddress) as longitude
    group every 30m by latitude, longitude
    select count() as count

  • Same as the previous query but selecting only those results where the count is greater than 200: 
    from demo.ecommerce.data
    select mmlatitude(clientIpAddress) as latitude
    select mmlongitude(clientIpAddress) as longitude
    group every 30m by latitude, longitude
    select count() as count
    where count > 200