I have a table containing the following.
pickup_date, Supplier_id, Location
pickup_date is a datetime, and supplier id is a number. Location is a string.
I would like to output a list ordered using the two datepart fields below (to match other data) giving a result per month for all suppliers. The last column should show the most frequent location for each supplier.
I believe where I am going wrong is the ordering of the group_by
datepart(year, b.pickup_date) Year,
datepart(month, b.pickup_date) Month,
I am Expecting: Year, Month, Supplier_Id, "MostfrequentPickupLocation".