Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7762699
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T14:28:31+00:00 2026-06-01T14:28:31+00:00

Why query: SELECT id, MAX(probe_time) AS Expr1 FROM app_states GROUP BY logon_id and SELECT

  • 0

Why query:

SELECT id, MAX(probe_time) AS Expr1
FROM app_states
GROUP BY logon_id

and

SELECT id, MIN(probe_time) AS Expr1
FROM app_states
GROUP BY logon_id

has same id result.

I wish to select row with MAX or MIN time for every user.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T14:28:33+00:00Added an answer on June 1, 2026 at 2:28 pm

    I’m afraid you’ll have to use sub queries here.

    SELECT id, probe_time
    FROM app_states
    WHERE probe_time = (SELECT MAX(probe_time) from app_states GROUP BY logon_id)
    

    BTW, SQLite does interesting optimization on MIN/MAX:

    Queries of the following forms will be optimized to run in logarithmic time assuming appropriate indices exist:

     SELECT MIN(x) FROM table;
     SELECT MAX(x) FROM table;
    

    In order for these optimizations to occur, they must appear in exactly the form shown above – changing only the name of the table and column. It is not permissible to add a WHERE clause or do any arithmetic on the result. The result set must contain a single column. The column in the MIN or MAX function must be an indexed column.

    — http://www.sqlite.org/optoverview.html#minmax

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

For the query: SELECT MAX(LOG_CREATION_DATE),COL_A, COL_B FROM IMPORT_LOG GROUP BY TO_CHAR(LOG_CREATION_DATE, 'MM-DD-YYYY'), COL_A, COL_B
Here's the query: SELECT COUNT(*) AS c, MAX(`followers_count`) AS max_fc, MIN(`followers_count`) AS min_fc, MAX(`following_count`)
Using the following query: SELECT pe.prodtree_element_name_l, MAX(rs.resource_value) AS resource_value FROM prodtree_element pe LEFT JOIN
When I execute this query: Dim Var Var = ("select max(Autonumber) from tblAutonumber") DoCmd.RunSQL
I want to write a query like this: SELECT o.OrderId, MAX(o.NegotiatedPrice, o.SuggestedPrice) FROM Order
I have a query that looks a bit like this: SELECT weekEnd, MAX(timeMonday) FROM
Query: SELECT DISTINCT ([Equipment List].ID) AS Expr1, [Job Assignments].Job FROM [Equipment List] LEFT JOIN
I have the following query: SELECT MAX([LastModifiedTime]) FROM Workflow There are approximately 400M rows
I have the following query: SELECT * from foo where timestamp = (select max(timestamp)
Query: select max(b.counter) as counter, b.m_group, b.m_code, a.s_id, s.id_sk from tbl_various a, tbl_map b,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.