List:General Discussion« Previous MessageNext Message »
From:Jacque Scott Date:February 20 2004 6:31pm
View as plain text  
I have the following query where the user will put in a date.  They will
put it in like '01/01/04'.  I use this date in my WHERE clause but MySQL
needs the date like '2004/01/01'.  I tried using Date_Format('04/01/01',
'%Y-%m-%d') to change the way it is formatted but I don't get the
correct data back.  Can someone help with this?
SELECT DISTINCTROW Products.NSIPartNumber, Sum(tblInvTransaction.Qty)
AS SumOfQty
FROM tblInvTransaction INNER JOIN Products ON
tblInvTransaction.ProductID = Products.ProductId
WHERE tblInvTransaction.Date <= Date_Format('01/01/04', '%Y-%m-%d')
GROUP BY Products.NSIPartNumber
HAVING Sum(tblInvTransaction.Qty)>0;

Date_FormatJacque Scott20 Feb
  • Re: Date_FormatDavid Griffiths20 Feb