Hi all, a question about the `!inner` join functio...
# help
s
Hi all, a question about the
!inner
join function in the JS client. Currently the data I get from the database is like the image on the left. The database returns me an array of object which contains another object called
images
with the
url
inside it. What I want to do is tell Postgres to return only array of
urls
from the the
images
table, which were obtained through the
!inner
join function via the table
item_image
. (Continue in the thread --->)
n
Hello @s c a p e g o a t! This thread has been automatically created from your message in #843999948717555735 a few seconds ago. We have already mentioned the @User so that they can see your message and help you as soon as possible! Want to unsubscribe from this thread? Right-click the thread in Discord (or use the ``...`` menu) and select "Leave Thread" to unsubscribe from future updates. Want to change the title? Use the ``/title`` command! We have solved your problem? Click the button below to archive it.
s
An example of what I want.
This is an example of my query.
My tables are like this:
Copy code
items
-- id
-- name

images
-- id
-- url

item_image
-- item_id
-- image_id
I'm not really sure how to approach this problem since array of foreign keys are still not supported by Postgres. If there's a better way, please suggest. I don't think this one is the best solution either. :P
My
images
table actually have other columns called
ref_table
and
ref_id
which I created as reference so that I can chain with another call to Supabase after obtaining the initial dataset from
items
. It turns out that I can use
!inner
with those two columns without setting up any actual foreign key relationships. I never tried this method when I built the APIs but it works so I guess my problem is solved then.