All pastes #138036 Raw Edit

kupesoft

public text v1 · immutable
#138036 ·published 2006-08-18 22:12 UTC
rendered paste body
/* Here is the outline for the table */

CREATE TABLE tbl (
  name VARCHAR(255),
  value INT(10) UNSIGNED,
  text TEXT
);

/*
I want to select every `name`, `value`, and `text` from the table
for every row that `name` is unique.  For the rows that `name` is
not unique, I need to select `name`, `value`, and `text` from ONLY
the row that has the highest `value`.

How do I do this?
*/