There is a table:
+----------------+ |ID |Name | +----------------+ |1000|WorkingJob1| |1001|WorkingJob1| |1002|WorkingJob1| |1003|SomeJob1 | |1004|SomeNewJob1| |1005|SomeNewJob1| |1006|AnotherJob1| |1007|AnotherJob2| +----------------+ You need to write a request that returns the ID and Name so that the Name does not repeat.
Result:
+----------------+ |ID |Name | +----------------+ |1000|WorkingJob1| |1003|SomeJob1 | |1004|SomeNewJob1| |1006|AnotherJob1| |1007|AnotherJob2| +----------------+ How to insert unique names is understandable using DISTINCT. But how to add another ID is not clear.
select min(ID), Name from table_name group by Name;- MaxUgroup by name. and for id you need to choose the right aggregate function, judging by the example you want the minimum ID, then you need to apply min (id) - Mike