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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T17:40:38+00:00 2026-06-05T17:40:38+00:00

Query 1: SELECT * FROM user_d1 WHERE EXISTS (SELECT 1 FROM `user_d1` WHERE birthdate

  • 0

Query 1:

SELECT * 
FROM user_d1 
WHERE EXISTS (SELECT 1 
              FROM `user_d1` 
              WHERE birthdate BETWEEN '1989-08-04' AND '1991-08-04') 
ORDER BY timestamp_lastonline DESC 
LIMIT 20

Query 2:

SELECT * 
FROM user_d1 
WHERE birthdate BETWEEN '1989-08-04' AND '1991-08-04' 
ORDER BY timestamp_lastonline DESC 
LIMIT 20

And what I really don’t understand: why does Query 2 return the wrong results? It returns a list ordered first by birthdate and then by timestamp_lastonline…

  • 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-06-05T17:40:39+00:00Added an answer on June 5, 2026 at 5:40 pm

    Query 1 : If at least one record between the dates exists then the entire talbe is retrieved.

    Query 2 : Only records between the dates are retrieved.

    Read here for how EXISTS works.

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

Sidebar

Related Questions

I have a MySQL query SELECT * FROM 'redirect' WHERE 'user_id'= \''.$_SESSION['user_id'].' \' ORDER
I have the following query: SELECT * FROM shop_user_member_spots WHERE delete_flag = 0 ORDER
If I run a query simialr to: SELECT * FROM user u LEFT JOIN
I have the following query: SELECT * FROM quotes INNER JOIN quotes_panels ON quotes.wp_user_id
In T-SQL you could have a query like: SELECT * FROM Users WHERE User_Rights
Query: SELECT u.user_id,r.totalVotes votes,r.totalPoints rating,@row:=@row+1 rank FROM mismatch_user u LEFT JOIN ratingItems r ON
I have a query like this SELECT user_id FROM user WHERE user_id NOT IN
SET @v1 := SELECT COUNT(*) FROM user_rating; SELECT @v1 When I execute this query
my query: SELECT id FROM user_follow WHERE user_id IN(3,6) AND follow_id NOT IN(3,6) GROUP
Yesterday my friend asked me a question about this query: select * from user

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.