0

I'm trying to write an SQL that calculates the total revenue from 1/2/2017 to 12/30/2017, but it does not recognise the second date. It says invalid position.

SELECT SUM(orderRevenue)
  AS "Total Revenue for 2017"
FROM transactionid
WHERE TransactionDate BETWEEN DATE '1/2/2017' AND DATE '12/30/2017';
Dharman
  • 26,923
  • 21
  • 73
  • 125

1 Answers1

1

You just need to use the correct date format -

SELECT SUM(orderRevenue) AS `Total Revenue for 2017`
FROM transactionid
WHERE TransactionDate BETWEEN '2017-01-02' AND '2017-12-30';
nnichols
  • 7,403
  • 1
  • 19
  • 26