Forum Discussion

Myko_P's avatar
Myko_P
Expert
8 years ago

What is wrong with my LiQl query?

Hi! I am trying to make component which can select and display all the users with "Moderator" role and one user with a specific username Myko_P. What am I doing wrong?   <#assign modId_request = r...
  • TariqHussain's avatar
    TariqHussain
    8 years ago

    Myko_P-

     

    as ChiaraS mentioned it will only return one user as you have used AND . However, i have tried this query with OR as well, result was still only one user.

     

    Please user two query :

     For all the users who has Moderator role.

    <#assign modId_request = rest("2.0","/search?q=" + "SELECT id FROM users WHERE rank.name = 'Moderator'"?url).data.items />

    For the Myko_P

    <#assign modId_request = rest("2.0","/search?q=" + "SELECT id FROM users WHERE login = 'Myko_P'"?url).data.items />

     

    Combine the result of both query.

     

    Give kudos if you find my posts helpful or mark solution if it answers your query

    Tariq