piheshpi90 Posted February 14, 2011 Share Posted February 14, 2011 im trying to create sql that display data from current year.so im using datepart().but error says -->FUNCTION e_latihan.DATEPART does not exist. why it say like that.can anybody help me find a resolution? "SELECT * FROM aktiviti WHERE year(`tarikh_akhir`)=DATEPART(GETDATE()) OR year(`tarikh_awal`) = DATEPART(GETDATE()) "; Link to comment https://forums.phpfreaks.com/topic/227580-get-current-year-problem/ Share on other sites More sharing options...
Pikachu2000 Posted February 14, 2011 Share Posted February 14, 2011 DATEPART and GETDATE aren't MySQL functions. SELECT * FROM aktiviti WHERE YEAR(`tarikh_akhir`) = YEAR( CURDATE() ) OR YEAR(`tarikh_awal`) = YEAR( CURDATE() ) Link to comment https://forums.phpfreaks.com/topic/227580-get-current-year-problem/#findComment-1173869 Share on other sites More sharing options...
piheshpi90 Posted February 14, 2011 Author Share Posted February 14, 2011 if i want to echo the current year..how to do that? Link to comment https://forums.phpfreaks.com/topic/227580-get-current-year-problem/#findComment-1173875 Share on other sites More sharing options...
fenway Posted February 14, 2011 Share Posted February 14, 2011 That's already in there. Link to comment https://forums.phpfreaks.com/topic/227580-get-current-year-problem/#findComment-1173889 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.