Sep 28, 2004 #1 KellyJo Technical User Sep 14, 2004 24 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 Jun 16, 2000 6,606 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 Feb 19, 2004 2,509 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")