SitePoint Sponsor

User Tag List

Results 1 to 3 of 3

Thread: MySQL and RSS document

  1. #1
    SitePoint Addict cms9651's Avatar
    Join Date
    Mar 2010
    Posts
    387
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    MySQL and RSS document

    Hi there.

    My problem today is this statement.
    Code:
         SELECT * FROM tblRSS
         WHERE DATEINSERT >= CURRENT_DATE - INTERVAL 2 DAY 
         ORDER BY MONTH(DATEINSERT) DESC, RAND() LIMIT 0, 1
    The `tblRSS` is populate with an RSS document and statement publish random record.

    But today strange import for the RSS document where `DATEINSERT`=2012-03-29 and the statement extract only this row where `DATEINSERT`=2012-03-29.
    The manual intervention resolves this anomaly....

    How to avoid future problems ?
    I hope your help.
    Thanks you very much for your help
    I'm really happy for your quickly answer.
    Good bye

  2. #2
    SQL Consultant silver trophybronze trophy
    SitePoint Award Recipient r937's Avatar
    Join Date
    Jul 2002
    Location
    Toronto, Canada
    Posts
    38,462
    Mentioned
    35 Post(s)
    Tagged
    1 Thread(s)
    CURRENT_DATE - INTERVAL 2 DAY would be 2012-03-04

    2012-03-29 is greater than 2012-03-04

    what was your question again?
    r937.com | rudy.ca | Buy my SitePoint book: Simply SQL
    "giving out my real stuffs"

  3. #3
    SitePoint Addict cms9651's Avatar
    Join Date
    Mar 2010
    Posts
    387
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    I'd appreciate your help so very much.

    My question: is possible to prevent this problem with my statement in mysql ?

    I don't not if the RSS document it's wrong ( 2012-03-29 ) in the `DATEINSERT`...
    Thanks you very much for your help
    I'm really happy for your quickly answer.
    Good bye

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •