I need to display different names but also have the id behind I'll show you the entire code:
splocation.Clear
Dim cursors As Cursor
cursors=sqldb.ExecQuery("SELECT distinct id,location FROM location ORDER BY location")
For i = 0 To cursors.RowCount - 1
cursors.Position = i
splocation.Add(cursore.GetString("location"))
spinnermap.Put(cursore.GetString("location"),cursore.GetInt("id"))
Next
cursors.Close
'--------------------------------
Ok, maybe it's so with SQLite. With other SQL db the distinct works only on the first field and you need parenthesis if you want a multifield distinct. I'm not using SQLite, sorry for the wrong answer.
as far as I recall from access, mssql and mysql distinct is a keyword that counts for everything of the select that comes after it.
You can verify it by swapping the fields in the select, the result should be the same.
here it looks if the combination of id & name is unique, which isn't due to the id in the distinct select and the double playername.
right (but distinct is actually the same as group by so the group by can be dropped in this case), if he didn't need the id. that's the point of all these replies