SQL date query question

    Date: 02/26/08 (Web Development)    Keywords: sql

    Suppose I have a table filled with events and a date for each event in 'datetime' format. I would like to construct an SQL query that returns a list of events within a specified 49 day block. How would I do this?

    SELECT *
    FROM events
    WHERE date
    BETWEEN 2008-03-01 10:00:51
    AND 2008-02-29 10:00:51

    Doesn't work, and I don't know where to go from here.

    Ideally I would like something with math involved like
    SELECT *
    FROM events
    WHERE date
    BETWEEN x
    AND (x+49)


    Do I use the AS keyword to do a TO_DAYS conversion? i haven't a clue.

    Source: http://community.livejournal.com/webdev/469305.html

« authorize.net reseller... || Printing issues in IE6 »


antivirus | apache | asp | blogging | browser | bugtracking | cms | crm | css | database | ebay | ecommerce | google | hosting | html | java | jsp | linux | microsoft | mysql | offshore | offshoring | oscommerce | php | postgresql | programming | rss | security | seo | shopping | software | spam | spyware | sql | technology | templates | tracker | virus | web | xml | yahoo | home