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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T22:06:15+00:00 2026-05-26T22:06:15+00:00

I have this table prices id | price_per_week | date_start | date_end 1 |

  • 0

I have this table “prices”

id | price_per_week | date_start | date_end
1  | 500            | timestamp  | timestamp
1  | 5000           | timestamp  | timestamp
2  | 100            | timestamp  | timestamp
3  | 300            | timestamp  | timestamp
3  | 200            | timestamp  | timestamp
3  | 6000           | timestamp  | timestamp
3  | 50             | timestamp  | timestamp
4  | 600            | timestamp  | timestamp
5  | 800            | timestamp  | timestamp
5  | 200            | timestamp  | timestamp

I want to get all the ids where their min and max value are between a price range. for example all the ids that have min price_per_week >= 200 and max price_per_week 1000.

When I run this query

SELECT id FROM prices WHERE price_per_week BETWEEN 200 AND 1000

it returns also the id 1,3 which have a max price_per_week greater than 1000

I think I should use subqueries somehow, but I am still learning…

  • 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-26T22:06:16+00:00Added an answer on May 26, 2026 at 10:06 pm

    If you only want id’s whose weekly price is always inside the range, try think like this:

    “Show me id’s that do not belong to set that have price out of range”

    SELECT id 
    FROM prices 
    WHERE id NOT IN (
      SELECT id
      FROM prices
      WHERE price_per_week not between 200 and 1000
    );
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this table: id feed_id ... Let's say that I have 500 rows
I have a table filled with purchase prices, like this: sku price btw startdate
I have this table in an Oracle DB which has a primary key defined
I have this table CREATE TABLE [dbo].[friend_blocked_list]( [subdomain] [varchar](50) NOT NULL, [un] [nvarchar](50) NOT
I have this table CREATE TABLE `codes` ( `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
i have this table in UTF8 (collation is utf8_bin in case it matters). I
I have this table: CREATE TABLE `test` ( `ID` int(11) NOT NULL auto_increment, `text`
I have this table: fourn_category (id , sub) I am using this code to
I have this table: CREATE TABLE `point` ( `id` INT(11) NOT NULL AUTO_INCREMENT, `siteid`
I have this table structure and would like to map it using Fluent Hibernate

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.