I am accessing an SQLite database using Ruby sqlite3
gem.
I have a table such as:
id | ip | nick
1 | 1.2.3.4 | abc
2 | 1.2.3.4 | def
3 | 1.2.3.4 | ghi
4 | 1.2.3.4 | jkl
5 | 1.2.3.4 | mno
and a query such as:
SELECT nick FROM table WHERE ip = '1.2.3.4'
but I want a single row returned, with all nicks for that IP address in alphabetical order:
nicks = ["abc", "def", "ghi", "jkl", "mto"]
What is the best method to achieve it?
Aucun commentaire:
Enregistrer un commentaire