Jump to content

DYI

Members
  • Posts

    4
  • Joined

  • Last visited

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

DYI's Achievements

Newbie

Newbie (2/6)

0

Reputation

  1. I'm sorry but you're wrong. I do can sort by "fruit=banana" in MySQL. "fruit=banana" gives you 1 or 0. Sorting by these two values works. I can rewrite query from the first post like this: SELECT pages.id, pages.parent_id, pages.templates_id FROM `pages` LEFT JOIN field_help_roles AS field_help_roles1 ON field_help_roles1.pages_id = pages.id AND field_help_roles1.data = '1' LEFT JOIN field_help_roles AS field_help_roles2 ON field_help_roles2.pages_id = pages.id AND field_help_roles2.data = '2' LEFT JOIN field_help_roles AS field_help_roles3 ON field_help_roles3.pages_id = pages.id AND field_help_roles3.data = '3' LEFT JOIN field_help_roles AS field_help_roles4 ON field_help_roles4.pages_id = pages.id AND field_help_roles4.data = '4' WHERE (pages.templates_id = 100) AND (pages.status < 1024) AND (NOT ISNULL(field_help_roles1.data) OR NOT ISNULL(field_help_roles2.data) OR NOT ISNULL(field_help_roles3.data) OR NOT ISNULL(field_help_roles4.data)) GROUP BY pages.id ORDER BY field_help_roles2.data = '2'; The problem is PW makes queries via subselects.
  2. I've analyzed queries made by framework and it looks impossible. Sad. SELECT pages.id, pages.parent_id, pages.templates_id FROM `pages` WHERE (pages.templates_id = 100) AND (pages.status < 1024) AND ( pages.id IN ( SELECT pages.id FROM `pages` JOIN field_help_roles AS field_help_roles ON field_help_roles.pages_id = pages.id AND (((field_help_roles.data = '1'))) ) OR pages.id IN ( SELECT pages.id FROM `pages` JOIN field_help_roles AS field_help_roles ON field_help_roles.pages_id = pages.id AND (((field_help_roles.data = '2'))) ) OR pages.id IN ( SELECT pages.id FROM `pages` JOIN field_help_roles AS field_help_roles ON field_help_roles.pages_id = pages.id AND (((field_help_roles.data = '3'))) ) OR pages.id IN ( SELECT pages.id FROM `pages` JOIN field_help_roles AS field_help_roles ON field_help_roles.pages_id = pages.id AND (((field_help_roles.data = '4'))) ) ) GROUP BY pages.id ORDER BY pages.name;
  3. Hi. I have a repeater field which contains FieldtypeOptions field with 4 options. How can I sort results in find() by presence of the values? # help_roles field options: 1=artist 2=leader 3=volunteer 4=sponsor Lets assume I want to sort results by artists. Tried this one but it only filters records by value 1: wire('pages')->find('template=repeater_requests, start=1, limit=20, sort=(help_roles=1)'); Any ideas?
×
×
  • Create New...