Records in a Date Range

    Date: 03/06/06 (MySQL Communtiy)    Keywords: no keywords

    I am trying to select records in a date range, but with this query I am not having any records returned. When I remove the BETWEEN statement and dont limit the range, I get results. Dates are yyyy-mm-dd format.

    SELECT invoice_items.caregiver_id, 
    sum(((TIME_TO_SEC(invoice_items.end_time) - TIME_TO_SEC(invoice_items.start_time))/3600))  AS invoice_hours, 
    employees.EmployeeID, employees.LastName, employees.FirstName
    FROM invoice_items 
    LEFT JOIN employees ON invoice_items.caregiver_id=employees.EmployeeID 
    WHERE invoice_items.office_id ='$office_id' AND invoice_items.item_date BETWEEN $ServRange1 AND $ServRange2 
    GROUP BY invoice_items.caregiver_id 
    ORDER BY employees.LastName
    

    Source: http://community.livejournal.com/mysql/88242.html

« HELP || Output validation? »


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