1----------08/10/2007----------Delivery----------Dorothy Haynes
2----------28/09/2007----------Delivery----------Dorothy Haynes
3----------08/10/2007----------Delivery----------Dorothy Kittrick
4----------28/09/2007----------Delivery----------Dorothy Kittrick
5----------01/10/2007----------Delivery----------Edith Gill
6----------08/10/2007----------Delivery----------Edith Gill
7----------28/09/2007----------Delivery----------Edith Gill
i need to return data like:
1----------08/10/2007----------Delivery----------Dorothy Haynes
3----------08/10/2007----------Delivery----------Dorothy Kittrick
6----------08/10/2007----------Delivery----------Edith Gill
cutting out duplicates using the latest date as the final result row.
i tried:
Expand|Select|Wrap|Line Numbers
- select vw_Requests.Request_ID, Pat_Fullname, vw_Requests.Request_Created
- from vw_Requests
- WHERE vw_Requests.Request_Type_ID = 3 and vw_Requests.Shop_ID = 012 AND vw_Requests.Run_ID Is Null
- group by vw_Requests.Pat_Fullname, vw_Requests.Request_Created
- having vw_Requests.Request_Created = max(vw_Requests.Request_Created)
- order by vw_Requests.Request_Created Desc
Column 'vw_Requests.Request_ID' is invalid in the select list because it is not contained in either an aggregate function or the GROUP BY clause.now i understand why the error occurs, but grouping by the id returns hundreds of rows and thus does not work, any ideas?
Best regards
HC