Jump to content

Pull distinct value from database


johnsmith153

Recommended Posts

 

 

field1 / field2

10  /  England

15  /  Italy

20  / France

15  /  France

30  /  USA

 

When searching for France:

SELECT DISTINCT field2, field1 FROM $tableName would return a distinct value. I want to ensure it returns the highest value in field1.

 

Something like this:

 

SELECT DISTINCT field2 (but ensure returns highest field 1 value), field1 FROM $tableName

Link to comment
https://forums.phpfreaks.com/topic/211611-pull-distinct-value-from-database/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.