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

  • Home
  • SEARCH
  • 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 8049585
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T06:49:19+00:00 2026-06-05T06:49:19+00:00

SELECT * FROM afspraken WHERE user_id = ‘2’ AND datum > ‘2012-06-05’ OR (

  • 0
SELECT * 
FROM afspraken
WHERE user_id =  '2'
AND datum >  '2012-06-05'
OR (
user_id =  '2'
AND datum =  '2012-06-05'
AND begintijd >=  '22:47'
)
ORDER BY datum DESC , begintijd ASC 

This above is my query.. And while i should get zero result i still get one which is:

id  user_id     datum      begintijd    opmerking
114 2         2012-06-05    9:30        Deze afspraak is online gemaakt.

Now if i have this correctly, this query has 2 options to give results.. which is:
The user_id must be the same AND the date has to be higher then 2012-06-05.. Since its the same date this won’t give the result..

Now the second option which is when the user_id is the same, the date is the same and when the beginningtime is the same or higher.. Now the time in the query shown is 22:47.. The time in the database is 9:30 morning.. How is 9:30 morning higher or equal to 22:47??

    id  int(10)                             
    user_id int(10) 
    datum   date    
    begintijd   varchar(5)
    opmerking   varchar(8000)
    reminder    int(10)
  • 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-05T06:49:21+00:00Added an answer on June 5, 2026 at 6:49 am

    The idea would be to cast your time columns and values to Time:

    SELECT CAST('20:05' AS Time) > CAST('9:06' AS Time) #returns 1 (compares times - what you want)
    
    SELECT '20:05' > '9:06' #returns 0 (compares strings - not what you want)
    

    Read more here.

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

Sidebar

Related Questions

SELECT * FROM articles WHERE title LIKE '%query%' AND user_id=123 The user_id column is
SELECT * FROM [makes$] WHERE Corporate Name='Champion Enterprises, Inc.' I'm running this query on
select * from table where key='çmyk' when i run this query on table that
SELECT * FROM mydb ORDER BY score DESC LIMIT 5 it will display 5
Select * from tableName order by id desc limit 10 How to perform something
select * from tableName where somecode = '$$$$$$$&8Y~$$$$' when I ran this query in
select * from tabName limit 25 by above query I get 25 rows and
SELECT * FROM (SELECT ROW_NUMBER() over ( ORDER BY CASE WHEN @SortExpression ='Country_id' THEN
SELECT * FROM `objects` WHERE (user_id IN ('7,8,12,9') AND visibility IN ('0,1')); but it
select * from sampleTable where CONVERT(VARCHAR(20),DateCreated,101) = CONVERT(VARCHAR(20),CAST('Feb 15 2012 7:00:00:000PM' AS DATETIME),101) I

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.