سؤال

The following function works fine, but I would like it to sort the results first by parent_id, and then by order.

def getTree = for {
  (a, c) <- Activities leftJoin Clients on (_.id === _.id_a)
} yield (a.id, a.label, a.parent_id, a.order, c.id.?, a=c.name)

How do I do that using Slick?

هل كانت مفيدة؟

المحلول

Like with ordinary collection ?

getTree.sortBy(r => r._3 ~ r._4)

نصائح أخرى

With Slick 2.1, I found this to work:

myQuery.sortBy(r => (r._3, r._4))

(verified by calling selectStatement on my query)

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top