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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T19:55:43+00:00 2026-05-31T19:55:43+00:00

I have the following MySQL database: |deal_name|price|shop|expiration_date – – – – – – –

  • 0

I have the following MySQL database:

|deal_name|price|shop|expiration_date
 - - - - - -  -  - - -
|sale1|110|shop1|03-30-2012 00:00:00
|sale2|120|shop1|03-29-2012 00:00:00
|sale3|130|shop2|03-12-2012 00:00:00
|sale4|140|shop2|03-29-2012 00:00:00
|sale5|150|shop3|03-30-2012 12:00:00
|sale6|160|shop3|03-30-2012 00:00:00

On my homepage I want to show 1 deal from each shop ordered by the price and the deal cannot been expired.

Example homepage:
sale1
sale5

I have now this:

SELECT *
FROM deals
WHERE DATE_FORMAT(expiration_date,'%Y-%m-%d') >=CURDATE() $cat
ORDER BY deal_id ASC

How can I do it? What do I have to add? Thank you!

  • 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-31T19:55:45+00:00Added an answer on May 31, 2026 at 7:55 pm

    If you don’t care about which deal you get then you can try adding MAX or MIN to the price and then grouping

    SELECT deal_name,MIN(price),shop
    FROM deals
    WHERE DATE_FORMAT(expiration_date,'%Y-%m-%d') >=CURDATE() $cat
    GROUP BY deal_name,shop
    ORDER BY deal_id ASC
    

    Untested, but should get you started.

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

Sidebar

Related Questions

I have the following data in mysql database which is an iframe from u-tube:-
I have following query and data saved in a MySQL database with a timestamp
In my mysql database I have the following information in a page name field.
I have the following serialized PHP array stored in a mySQL database: a:2:{i:2070;s:4:0.00;i:1901;s:4:1.00;} Now,
I have a MySQL innodb database at 1.9GB, showed by following command. SELECT table_schema
In my MySQL database, I have the following column type. Field | Type |
I have the following code that adds a record to my MySQL database via
I have following tables in my MySql database : +----------------------------------------------+ PROJECT +----------------------------------------------| +----------------------------------------------| project_id
I have the following database -- MYSQL DROP TABLE IF EXISTS Attributes; DROP TABLE
I have following Scenario: PHP(Server, Writer) ----> MySQL Database <------ PHP(Client, Reader/ Writer); PHPS

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.