@ George
re: I would expect to get the results either way.
I do not quite get what you mean to say? Could you explain further?
re: When using order_by, I get results that are not what I expected.
I double checked the query being sent to the db, it is correct.
re: If I use [connections template="cmap" order_by="organization"...,the first four entries returned are “17a-4”, “2nd Chair Services”, “7Safe” and “911 Forensic Data”.
That looks correct.
re: If I use [connections template="cmap" order_by="organization,state"..., the first four entries returned are “17a-4”, “AccessData”, “Advanced Discovery” and “Avansic”. The difference, I think, is that no addresses have been entered for “2nd Chair Services”, “7Safe” and “911 Forensic Data”.
I believe the db will “discard” records or maybe “prioritizes” the records in which there is data available. I’d have to look that up. But, if it is the former, then those entries simply would not be displayed as results. If it is the later, then the entries without the data (state) would be last in the results. Either way, the solution is to make sure the entries which you want to sort have data to sort by.
Ohhh… I just thought of another third possibility. When the query is made to the db, it has to join the main data table with the address table. This joining is based on the entry ID. So, only entries with addresses will be returned as results and only those will be sorted. Anyway, the solution is the same, if you are going to sort by it, you need to have data in the field that your are sorting by.
Hope that helps!
