Skip to content
Advertisement

How can I find datas smaller than “this sunday” in mysql

I have a mysql table and a date colomb that show when I add datas…

I wanna select datas smallar than this sunday from table..

HOw can I do that_? here is my code…

I couldnt figure it out “sevk_tarihi < DAY(3)”…

foreach($baglanti->query('SELECT SUM(sistem_adedi),sevk_tarihi FROM
databasename WHERE  (sistem_tipi_data="CEDRUS" 
or  sistem_tipi_data="PINO"
or sistem_tipi_data="BOSSO" 
or sistem_tipi_data="JUNIPER"
or sistem_tipi_data="OLIVA" 
or sistem_tipi_data="CARPE" 
or sistem_tipi_data="SELVI" 
or sistem_tipi_data="AINE" 
or sistem_tipi_data="SEKOYA" 
or sistem_tipi_data="DAPHNE" 
or sistem_tipi_data="WILLOW" 
or sistem_tipi_data="SEKOYA" )
and (sevk_tarihi < DAY(3)) ' )   as $row)

Advertisement

Answer

I am sorry, I misunderstood the question

This gives you past sunday

set @date = curdate() ;
SELECT @date - interval weekday(@date) + 1 DAY;

this gives you next sunday

set @date = curdate();
SELECT @date + interval 6 - weekday(@date) day;

for your query

sevk_tarihi < curdate() + interval 6 - weekday(curdate()) day

gives you this sunday

User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement