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 7638675
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T08:13:53+00:00 2026-05-31T08:13:53+00:00

I have a table called items. IN this table there are many columns. One

  • 0

I have a table called items. IN this table there are many columns. One of the columns is called ‘source’. What I would like to do is select records from the table. I would like to select the latest 5 records with the condition that the ‘source’ columns are all distinct.

I tried the following:

SELECT DISTINCT SOURCE from items order by time DESC LIMIT 5

but I need the whole record not just the source, when I try to include more columns it doesn’t work .

I tried this:

SELECT * FROM items  WHERE item_section='sp_500'   GROUP BY source  ORDER BY time DESC    LIMIT 3

but it doesn’t give me the LATEST records

  • 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-31T08:13:53+00:00Added an answer on May 31, 2026 at 8:13 am

    Tricky.

    Try this.

    SELECT items.* 
      FROM items
      INNER JOIN 
        (SELECT source, max(time) maxtime
           FROM bbc
           GROUP BY source
           ORDER BY max(time) DESC
           LIMIT 5
        ) s
    ON items.source = s.source and items.time = maxtime
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have two table TempStore and Store with the same column called Items. There
I have a MySQL table called items that contains thousands of records. Each record
let's say that I have a table called Items (ID int, Done int, Total
I have two tables, one called cart and one called items. Now I want
I have a table called BlogPost which has a 1-to-many relationship with the Comment
I have two tables with a many-to-one relationship. (Oracle) **Table: PARENT** Field: A (PK)
Okay, so I have a (SQLite) table called log wherein one column (time) is
Alright there's two ways this can go. One is from the presentation side, and
I would like to know if locking my table is necessary in this situation
I am using MYSQL and PHP. I have a table called item. Two of

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.