Reputation: 55
I wanna select sales of daily for show on a graphic in a website and used to DATEDIFF and DATEADD functions but I get an SQL ERROR.
My table:
query of i was tried:
SELECT SUM(satis_fiyat) AS satis_fiyat from satis WHERE DATEDIFF(NOW() , DATEADD(DAY,-1,NOW())) ;
SQL ERROR:
Hata SQL sorgusu: Belgeler SELECT SUM(satis_fiyat) AS satis_fiyat from satis WHERE DATEDIFF(NOW() , DATEADD(DAY,-1,NOW())) LIMIT 0, 25 MySQL çıktısı: Belgeler #1305 - FUNCTION kaya.DATEADD does not exist
Upvotes: 0
Views: 2980
Reputation: 7496
Replace DATEADD
by DATE_ADD
, since DATEADD doesn't exist in MariaDB and is interpreted as a stored function which doesn't exist in schema kaya.
For parameters of DATE_ADD()
function please read the documentation.
Upvotes: 0
Reputation: 1270573
Maria DB uses interval
logic:
curdate() - interval 1 day
I can't figure out what you are trying to do. But that subtracts a day from the current date (without a time component).
Presumably, you want some comparison, such as:
<datecol> > curdate() - interval 1 day
Upvotes: 1