I am trying to extract the day of the week from a timestamp in SQL Server.
I am specifically looking for the SQL Server equivalent syntax to EXTRACT.
I want to count how many fields are in each day of the week.
This is how I would do it on BigQuery:
SELECT
EXTRACT(DAYOFWEEK FROM order_date ) as day,
count(*) count_trips
FROM `sales.orders`
group by EXTRACT (DAYOFWEEK FROM order_date)
Try this:
example:
P.S. I am helping you the day part only considering you know the rest of your code. Feel free to reply this for exact query.