http://GameProgrammer.Com

Programming

GP Mailing List
     Thread Index
     Date Index

ATXGPSIG List
     Thread Index
     Date Index

Google
>

Home

Wise2Food



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[gameprogrammer] Re: SQL Question



I'm not sure what database you're using, they each have their own
quirks about syntax and abilities but it should be something like
this...

select column1, column2, max(column3) from mytable group by column1,column2


On 1/11/08, Kevin Jenkins <gameprogrammer@rakkar.org> wrote:
> I want to order a table by a column, and return the first row that has
> a unique value for a different pair of columns.
>
> For example:
>
> Column_1, Column_2, Column_3
> John,     Doe,      $85
> John,     Archer,   $90
> Bob,      Barker,   $70
> John,     Doe,      $60
>
> It should return
> John,     Doe,      $85
> John,     Archer,   $90
> Bob,      Barker,   $70
>
> Because John, Doe appears twice, it only returns the row with the
> higher value for Column 3
>
> How would I do this?
>
> Thanks!
>
> ---------------------
> To unsubscribe go to http://gameprogrammer.com/mailinglist.html
>
>
>

---------------------
To unsubscribe go to http://gameprogrammer.com/mailinglist.html