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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T12:59:29+00:00 2026-05-13T12:59:29+00:00

I need some help figuring out and SQL Statement. I know what I want

  • 0

I need some help figuring out and SQL Statement.

I know what I want I just cant express it.

Im using php, so it doesnt need to be exclusivly SQL, its to act as a filter.

Pseudo code

$query="SELECT * FROM MyTable WHERE 'TIS'  is not older than 2 days or empty  = ''$ORDER"; }

TIS in the name of the column in my table were I store dates in this format 03-12-09 (d,m,y).
The $ORDER is for ordering the values based on values from other fields not dates.

Im looking at

SELECT * 
FROM orders
WHERE day_of_order >
(SELECT DATEADD(day,-30, (SELECT MAX(day_of_order) FROM orders)) AS "-30 Days");

But i dont quite think im on the rigth track with this.

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-13T12:59:29+00:00Added an answer on May 13, 2026 at 12:59 pm

    So, I was pretty lost in all this.

    How did it got solved:

    • First I understood that the Statement I was using was not supported by MySql thanks to eligthment from Bob Jarvis.

    _ Second In a comment by vincebowdren wich “strongly” adviced me to change the data type on that field to Date wich indeed I had not, it was a string.

    It was pretty Dumb for me to try using SQL operations for Dates on a field that had String values.

    So I just RTFM: http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html

    and:

    mysql> SELECT something FROM tbl_name
    -> WHERE DATE_SUB(CURDATE(),INTERVAL 30 DAY) <= date_col;

    Then proceeded to change the field value to date.

    and this is my perfectly working query:

    $query="SELECT * FROM MyTable WHERE DATE_SUB(CURDATE(),INTERVAL 2 DAY) <= TIS OR TIS = 0000-00-00 $ORDER "; }

    I would like to thank the posters for their aid.

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

Sidebar

Ask A Question

Stats

  • Questions 284k
  • Answers 284k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer The tipsy plugin seems to remove the title attribute and… May 13, 2026 at 4:24 pm
  • Editorial Team
    Editorial Team added an answer I had just installed Apache 2 on Ubuntu and it… May 13, 2026 at 4:24 pm
  • Editorial Team
    Editorial Team added an answer While it would be possible to match ' and the… May 13, 2026 at 4:24 pm

Related Questions

var auditAgencyRecords = (from ag in db.Agencies join ara in db.AuditRuleAccounts on ag.Agency_Id equals
I've been learning F#, and I'm writing a tool in it. Everything works fine
I need some help figuring out what I'm doing wrong here. I am trying
I'm looking to implement the Shunting-yard Algorithm , but I need some help figuring
I am writing a macro in MS word. I need the macro to parse

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.