Android Example [B4X] Supabase - Database Joins


In the following example I make a join into the "public.users" table and need the column "username" from it.
B4X:
    Dim Query As Supabase_DatabaseSelect = xSupabase.Database.SelectData
    Query.Columns("message,created_by,id, users(username)")
    Query.From("dt_Chat")
    Query.Filter_Equal(CreateMap("room_id":3))

    Wait For (Query.Execute) Complete (DatabaseResult As SupabaseDatabaseResult)
  
    For Each Row As Map In  DatabaseResult.Rows
      
        AddItem(Row.Get("message"), Row.Get("created_by") = User.Id,Row.Get("users.username"))
      
    Next

Join Public.users ON users.username:
B4X:
Query.Columns("message,created_by,id, users(username)") 'Join Public.users ON users.username

Get the joined column:
B4X:
Row.Get("users.username")

Join the Auth.Users Table:
 
Last edited:

elitse

Member
Hello Alexander, First, thank you for this wonderful library.

My question is, can we do a join with a table in a schema that is not public? for example, join the auth.user with Public.user?
 

Alexander Stolte

Expert
Licensed User
Longtime User
My question is, can we do a join with a table in a schema that is not public? for example, join the auth.user with Public.user?
No it's not possible.
And if you now create a new thread for the question, then you will even get a solution from me for the problem.
 
Top