How would I format the following query? select to_char(datetime,'YYYY-MM-DD') as date,url,sum(number_requests) from request group by date,url order by date,url; I have tried several different iterations, but the "as date" seems to trip me up. Any help would be appreciated, thanks.