How can I construct following query in xano ui ?

Options

Here is my database structure

I want to execute following query for Identification and Access Management :

SELECT user_id,MAX(create_emp),MAX(read_emp),MAX(update_emp),MAX(delete_emp) FROM member JOIN permission_group ON member.group_id = permission_group.id GROUP BY user_id HAVING user_id = 2;

Can someone help me how can I construct this query in xano ui ?

Answers

  • Ray Deck
    Ray Deck Trusted Xano Expert ✭✭✭
    Options

    You can do some backflips to do this in a single query, but I wouldn't because of the nightmare explaining it to the next person . I'd query all records the member table where the user id is X. Then in the output set an an add-on connecting to the permission_group table single record. Then I would make a value "create_emp" based on member_1.create_emp with a max filter on it. That would give me the max create_emp (identifying whether I have that permission). Do that times the other four fields.

    The preceding would be much easier to explain to the next person, meaning I wouldn't have to babysit it for all time, which is, to me, a big value of putting things into a nocode backend!

    Hope some of the above helps. We make Xano do backflips all the time as part of our focus on the hardest 5% at Statechange.ai daily office hours and our forum.