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
Post a Comment