1

For example if I take a simple SQL query:

Select user WHERE name = jack ORDER BY date_added ASC

The firebase Query to retreive all users with name jack will look like:

myRef.orderByChild("name").equalTo("jack")

but if I add

myRef.orderByChild("name").equalTo("jack").orderByChild("date_added")

I will get

java.lang.IllegalArgumentException: You can't combine multiple orderBy calls!

so how can I order by ASC and DESC after using orderBy and equalto?

  • I don't know how firebase works, but in plain sql you can order by two columns just putting then together in the order clause, but separated by comma: http://stackoverflow.com/questions/2051162/sql-multiple-column-ordering – jonathanrz Nov 26 '16 at 19:14

1 Answers1

4

you can't use orderByChild more than one time. i ran into this problem and i ended up by using orderByChild once and filter the data on my client . you can refer to this answer , it will help you

Community
  • 1
  • 1
Mohamed Nageh
  • 1,963
  • 1
  • 19
  • 27