BlessPanda
BlessPanda

Reputation: 1

Eliminate Duplicate Values with different id but same text

i'm currently working on a software which displays the text values of a table in a combobox.The software have already a logic, which write the SQL commands with help of a MappingRessource.properties. For this you need the id and the text value. The problem is that, there are duplicate text values with different ids. Can someone explain me, how i can get only one of the duplicate values in my combobox?

enter image description here

SELECT DISTINCT id as id, description as text FROM engine WHERE description IS NOT NULL

Upvotes: 0

Views: 37

Answers (1)

FredvN
FredvN

Reputation: 544

When the value of the id is not important you can use

SELECT min(id) as id, description as text FROM engine group by description WHERE description IS NOT NULL

Upvotes: 1

Related Questions