sql - Converting MySQL query to PostgreSQL. Order by day()? -


i'm converting code mysql postgresql. postgresql doesn't have day() function order by work. there known solution? i'm wanting group results day.

        {          select to_char(date, 'yyyy-mm-dd') date         \"users exercises\"         userid = $user->id , (date >= '$begin' , date <= '$end')         group day(date)         order date          ) union (          select to_char(date, 'yyyy-mm-dd') date         \"users foods\"         userid = $user->id , (date >= '$begin' , date <= '$end')         group day(date)         order date          } 

mysql's day() returns day of month. postgresql equivalent of is:

group extract(day "date") 

Comments

Popular posts from this blog

facebook - android ACTION_SEND to share with specific application only -

python - Creating a new virtualenv gives a permissions error -

javascript - cocos2d-js draw circle not instantly -