0

I'm using the query module, to return a list of entries sorted alphabetically, but there are a few sticky entries that I need to appear at the top of the list, and the stickies are being ignored.Here is my query:

{exp:query sql="SELECT entry_id AS rel_entry_id, title AS rel_title, (SELECT rel_child_id FROM exp_relationships WHERE rel_id = '{select-location}' LIMIT 1) AS rel_child_id FROM exp_channel_titles WHERE channel_id IN (5, 7) AND status='Open' ORDER BY title ASC "}

I tried adding sticky to my select, and 'sticky, title' to the ORDER BY parameter, but it didn't work. Is there a way to get it working?

1 Answer 1

4

try to add sticky DESC

{exp:query sql="SELECT entry_id AS rel_entry_id, title AS rel_title, (SELECT rel_child_id FROM exp_relationships WHERE rel_id = '{select-location}' LIMIT 1) AS rel_child_id FROM exp_channel_titles WHERE channel_id IN (5, 7) AND status='Open' ORDER BY sticky DESC, title ASC "}
1
  • That did it. I didn't even think about adding DESC. Thanks!
    – artmem
    Dec 4, 2014 at 18:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.