Re: Using MAX function to fetch primary id

2007-09-10 Thread Brent Baisley
You can do it as long as there is only a single record with the max value. If there is more than 1 record with the same max value, there isn't a single record to pull. To do it, you would need to join on the results of the max query, and part of the join condition would be the max value S

RE: Using MAX function to fetch primary id

2007-09-07 Thread Daevid Vincent
> -Original Message- > I need to select a max value for a group of records and I > also need the > primary key for that record. > > I am wondering if this can be done with a single query? e.g > > Table_x > > id count cat_id > 110 1 > 220 2 > 335

Using MAX function to fetch primary id

2007-09-07 Thread Cathy Fusko
Hi, I need to select a max value for a group of records and I also need the primary key for that record. I am wondering if this can be done with a single query? e.g Table_x id count cat_id 110 1 220 2 335 2 415 1 with SELECT id, cat_id, max