MySQL Subquery in Query Builder

Hi Everybody,
I m not a so big expert then maybe I m asking something easy, but I don’t find a solution.

I have two tables in MySQL db I used to give access to other lists to the clients.

First table is called: xxxx_user and it is the table where are stored id, username and password to give access the application.
Structure is:

id (INT)
usr_name(varchar)
usr_password(varchar)

The second table is called xxx_regauth and have inside the ID of the Item and the id of the users that has access on it

xxx_regauth

regauth_id(int)
regauth_idregistry(int) //where it is stored the ID of the item)
regauth_iduser(int) // where it is stored the ID of the user

for each item coud be that have multiple users (then will have different lines)

Now the question is the following: I need to list for item X the users that are not authorized. If ound in MySQL the following query, with a Subquery:

SELECT * FROM xxx_user
WHERE xxx_user.id NOT IN (SELECT regauth_iduser FROM xxx_regauth where xxx_regauth.regauth_idregistry = 20);

The question are:

  1. How could I set the same query (or get same result) using Query Building of Wappler?

  2. How can I pass the GET_id info to the subquery? (where xxx_regauth.regauth_idregistry = 20)

I tried to make a VIEW in MySQL and manage it in wappler like normal query but I got problem to pass the GET_id from ServerConnect to the Subquery.

Maybe I make wrong structure or I don’t know… I m newbie :slight_smile: please don’t judge me too bad :slightly_smiling_face:

Thank you very much

Roberto

Community Page
Last updated: