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

  • SEARCH
  • Home
  • 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 7590533
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T20:25:31+00:00 2026-05-30T20:25:31+00:00

I have the following table test, Let the data in the table be as

  • 0

I have the following table “test”,

enter image description here

Let the data in the table be as follows,

enter image description here

Now I want to select last entry (only date not the timestamp) for each day and corresponding value as two columns. one being the date and other being the value.

I am able to fetch only the date using the following query,

SELECT max( date( date ) ) AS date
FROM test
GROUP BY date( date )
LIMIT 0 , 30 

But am not being able to get the corresponding values for those dates.
How can I do it..? By googling, I came to know that I have to use join to achieve this, but again I couldn’t use join without any errors.

  • 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-05-30T20:25:32+00:00Added an answer on May 30, 2026 at 8:25 pm

    First change the column name from the reserved keyword date to something that doesn’t need quoting:

    ALTER TABLE test
        CHANGE COLUMN `date` timestamp_entered TIMESTAMP NOT NULL
                             --- or some other sensible name
    

    Then you could use:

    SELECT
        grp.date_entered  
      , t.value 
    FROM 
            test  AS t
        JOIN 
            ( SELECT 
                , DATE( timestamp_entered )  AS date_entered
                  MAX( timestamp_entered )   AS max_timestamp
              FROM 
                  test
              GROUP BY
                  DATE( timestamp_entered )
            ) 
              AS grp 
          ON 
              grp.max_timestamp = t.timestamp_entered
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following table and data: CREATE TABLE `test` ( `id` int(11) NOT
I have the following test-code: CREATE TABLE #Foo (Foo int) INSERT INTO #Foo SELECT
When I have the following table: CREATE TABLE test ( id integer NOT NULL,
I have the following mysql table called test. lets say it has the data
Let's say I have the following table first last value tony jones 1 james
I have the following table in postgres: CREATE TABLE test ( id serial NOT
I have the following table: CREATE TABLE TEST(ID TINYINT NULL, COL1 CHAR(1)) INSERT INTO
I have a table defined by the following SQL: CREATE TABLE test ( id
I have the following table schema; CREATE TABLE `db1`.`sms_queue` ( `Id` INTEGER UNSIGNED NOT
I have the following table structure CREATE TABLE `table` ( `id` int(11) NOT NULL

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.