Sep 28, 2004 #1 KellyJo Technical User Joined Sep 14, 2004 Messages 24 Location US Can anyone tell me how to fix this code so that it works? You can't have an aggregate function in a where clause. s = "SELECT [ID] as PK, ERName AS ERName FROM [Staffing Data] WHERE [ID] = max([ID])" Thanks! KellyJo
Can anyone tell me how to fix this code so that it works? You can't have an aggregate function in a where clause. s = "SELECT [ID] as PK, ERName AS ERName FROM [Staffing Data] WHERE [ID] = max([ID])" Thanks! KellyJo
Sep 28, 2004 #2 RoyVidar Instructor Joined Jun 16, 2000 Messages 6,606 Location NO That's not code, that's SQL, there is a forum for queries and sql (forum701) [tt]...where id=(select max(id) from [staffing data])[/tt] or [tt]select top 1 id as pk <rest of statement> order by id desc[/tt] Roy-Vidar Upvote 0 Downvote
That's not code, that's SQL, there is a forum for queries and sql (forum701) [tt]...where id=(select max(id) from [staffing data])[/tt] or [tt]select top 1 id as pk <rest of statement> order by id desc[/tt] Roy-Vidar
Sep 28, 2004 #3 lupins46 MIS Joined Feb 19, 2004 Messages 2,509 Location GB s = "SELECT [ID] as PK, ERName AS ERName FROM [Staffing Data] WHERE [ID] = dmax("[ID]","Staffing Data") Upvote 0 Downvote
s = "SELECT [ID] as PK, ERName AS ERName FROM [Staffing Data] WHERE [ID] = dmax("[ID]","Staffing Data")