All pastes #136680 Raw Edit

kupesoft

public text v1 · immutable
#136680 ·published 2006-08-17 20:53 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?
*/