Search code examples
sqlmariadbdatediffdateadd

MariaDB -- #1305 - FUNCTION kaya.DATEADD does not exist


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:

enter image description here

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

Solution

  • 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