Hello -
I'm trying to format a date (which works) howerver, I'm getting "Unknown column 'newDate' in 'where clause'"
Here's my sql statement:
SELECT *, STR_TO_DATE(invDetails.invoiceDate,'%m/%d/%y') AS newDate
FROM stores AS store
INNER JOIN invoice_details AS invDetails
ON store.sCustNum = invDetails.sCustNum
WHERE store.sSalesman = 508 AND store.BillToId = 7161
AND newDate BETWEEN '2012-01-01' AND '2012-12-31'
GROUP BY store.sCustNum
Here's the output WITHOUT the BETWEEN logic
(
[id] => 1216
[billToId] => 7161
[sCustNum] => VS7121
[sNumber] => 5263
[sSalesman] => 508
[sName] => CIRCLE K PICKERINGTON
[sAddress] => 29 S HILL RD
[sCity] => PICKERINGTON
[sState] => OH
[sZip] => 43147-1218
[sPhone] => 6148379337
[sFax] =>
[sContact] =>
[cId] => VS7121
[invoiceNumber] => 097319
[repNumber] => 512
[invoiceDate] => 1/10/11
[payMethod] => 2
[invoiceType] =>
[invoiceHistory] => 1
[newDate] => 2011-01-10
)
Can't think of whatI might be doing wrong... thanks for any help you can provide me.