| Author |
getting highest primary key value
|
|
|
| Hi I have a table like
*******************
*pri key * varchar (20)*
********************
* 1 * tom *
* 2 * joe *
* 3 * paul *
Need a query that gets the highest pri key value. thanks.
mabye something like
SELECT field1
FROM table
WHERE field1 IS MAX
Paul G
Software engineer.
| |
|
| meant to put this in the sqlserver group
"Paul" wrote:
> Hi I have a table like
> *******************
> *pri key * varchar (20)*
> ********************
> * 1 * tom *
> * 2 * joe *
> * 3 * paul *
> Need a query that gets the highest pri key value. thanks.
> mabye something like
> SELECT field1
> FROM table
> WHERE field1 IS MAX
> Paul G
> Software engineer.
| |
| Uri Dimant 2005-05-03, 7:23 am |
| Paul
Try this
SELECT field2, MAX(field1)
FROM table
GROUP BY field2
Paul G
"Paul" <Paul@discussions.microsoft.com> wrote in message
news:A2B750B6-990D-4B56-B0CE- 301F81FF384C@microso
ft.com...[color=darkred]
> meant to put this in the sqlserver group
>
> "Paul" wrote:
>
| |
|
| ok thanks this seemed to work.
"Uri Dimant" wrote:
> Paul
> Try this
> SELECT field2, MAX(field1)
> FROM table
> GROUP BY field2
>
> Paul G
>
> "Paul" <Paul@discussions.microsoft.com> wrote in message
> news:A2B750B6-990D-4B56-B0CE- 301F81FF384C@microso
ft.com...
>
>
>
|
|
|
|