Undefined function 'STR_TO_DATE' in expression mysql msacess

-2

I get the following error:

System.Data.OleDb.OleDbException (0x80040E14): Undefined function 'STR_TO_DATE' in expression.

when I run this query

SELECT 
    ProductCode, 
    Description, 
    SUM(Quantity) as Quantity, 
    STR_TO_DATE(REPLACE(DateIn, '-', '/'), '%m/%d/%Y') as DateIn 
FROM 
    Product as P, 
    StockIn as S 
WHERE 
    S.ProductNo = P.ProductNo 
    AND 
    STR_TO_DATE(REPLACE(DateIn, '-', '/'), '%m/%d/%Y') BETWEEN '" + StartDate.ToString("yyyy-MM-dd") + "' AND '" + EndDate.ToString("yyyy-MM-dd") + "' GROUP BY P.ProductNo, DateIN ORDER BY DateIn, Description";
mysql
sql
ms-access
asked on Stack Overflow Jan 18, 2018 by Ibrahim Jeremy • edited Jan 18, 2018 by Gustav

1 Answer

0

Try with Access SQL:

"SELECT
    ProductCode, 
    Description, 
    SUM(Quantity) as Quantity, 
    DateValue(DateIn) as DateIn 
FROM 
    Product as P, 
    StockIn as S 
WHERE 
    S.ProductNo = P.ProductNo 
    AND 
    DateValue(DateIn) BETWEEN #" + StartDate.ToString("yyyy-MM-dd") + "# AND #" + EndDate.ToString("yyyy-MM-dd") + "# GROUP BY P.ProductNo, DateValue(DateIn) ORDER BY DateValue(DateIn), Description";
answered on Stack Overflow Jan 18, 2018 by Gustav

User contributions licensed under CC BY-SA 3.0