mercredi 29 avril 2015

How can I sort ensuing columns according to value in first column? (sqlite)

Let's call the first column below the guide key, which is 1 in all of these rows.

1|5|bagels|1|coffee|1|eggs|5|espresso|1|muffins 1|5|bagels|1|coffee|1|eggs|5|espresso|2|muffins 1|5|bagels|1|coffee|1|eggs|5|espresso|3|muffins 1|5|bagels|1|coffee|1|eggs|6|espresso|1|muffins 1|5|bagels|1|coffee|1|eggs|6|espresso|2|muffins 1|5|bagels|1|coffee|1|eggs|6|espresso|3|muffins 1|5|bagels|1|coffee|1|eggs|7|espresso|1|muffins 1|5|bagels|1|coffee|1|eggs|7|espresso|2|muffins 1|5|bagels|1|coffee|1|eggs|7|espresso|3|muffins 1|5|bagels|1|coffee|1|eggs|8|espresso|1|muffins

The ensuing rows have the format: key|value. For example, 5 is a key, bagels is a value, etc. I want to keep only the values of the row with the most keys matching the guide key. So the output for this data set should look like: 1|coffee|eggs|muffins

How can I do this in sqlite3?

Aucun commentaire:

Enregistrer un commentaire