I don’t think there is need for, order_by multiple columns since the result is still determine by the the order of the first column passed in order_by option
The additional columns affect the sort order too. Image order_by: [:date, :time]
. First the data is ordered by date, and then within date ordered by time.
Have seen the point now , thank you
query = from t in "tracks", select: {t.album_id, t.title, t.index}, order_by: [t.album_id, t.index] Repo.all(query)
[{1, "bongo", 1}, {2, "mix", 1}, {2, "bongo", 4}]
query = from t in "tracks", select: {t.album_id, t.title, t.index}, order_by: [t.album_id]
Repo.all(query)
[{1, "bongo", 1}, {2, "bongo", 4}, {2, "mix", 1}]