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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T20:13:26+00:00 2026-05-24T20:13:26+00:00

I was asking, but it misleading, so sorry for that. my problem is. i

  • 0

I was asking, but it misleading, so sorry for that. my problem is.

i have a table ranks(rank_id, rank_name, rank_min, rank_max)

is simple if i want know only one rank

select * from ranks where (224 between rank_min and rank_max)

but if want to know more than one rank, like what is 224, 338, 800, etc

i can use

select * from ranks where (224 between rank_min and rank_max) OR (338 between rank_min and rank_max) OR (800 between rank_min and rank_max)

but i dont know if may be there is simple way, like using

 IN(224,338,800)

and how to write a query in PHP that is not fix, i mean in solution 1, using many BETWEEN OR.

in PHP i know if it a siple query like select * from ranks where (224 between rank_min and rank_max). just pas the value. but i dont know how if more then one value

any body have trick and sample how to do that. i hope this question is not misleading

Thanks

  • 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-24T20:13:27+00:00Added an answer on May 24, 2026 at 8:13 pm

    I had an idea, I don’t know if it’s better than making the query dynamically with PHP, but it’s worth a shot :

    SELECT *
    FROM ranks
    INNER JOIN (SELECT unnest(ARRAY[224, 338, 800]) AS n) TT
        ON n BETWEEN rank_min AND rank_max;
    

    You’d just have to make the array dynamically with PHP, but should be much easier than making the whole query.

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

Sidebar

Related Questions

I'm re-asking this question but with a different framework this time. I have two
I feel stupid for asking, but there must be a one liner that does
I apologize for asking such a generalized question, but it's something that can prove
I don't know if i am asking a silly question but I want to
I struggled asking that question but here it is. I am using source control
I feel like an idiot for even asking this but does anyone have any
Sorry if the title of the question is a little misleading but I was
not sure if this is the right place to be asking but i have
i feel dumb for asking this but i have been fighting with this for
I'm sorry for asking a really stupid question, but since facebook changes its ways

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.