Matching values from multiple arrays
Hi there,
I have the following set-up:
----
Database table: users
- userID
- name
- companyID
------
Database table: messages
- messageID
- target_users (which is an array() that simply contains userID's)
------
Array companies: which is just a list of companyID's
Now what I want to do is the following:
A query that says:
SELECT FROM messages WHERE target_users [CONTAINS ANY USERS THAT HAS OWNER any company within my list of companies]
Noteworthy: I might have multiple users under this company, and obviously multiple companys. And, multiple messages that can apply.
I'm not sure if I'm expressing myself clearly. What I want to do is: I have two arrays, and via a Query I need to match all the hits in between these two arrays. I tried around a little with left joins but I'm not too experienced with PostgreSQL and Xano's set-up around it.
Answers
-
Hey @Gi Ma - where does your companies array sit? is there a relationship between companies and users?
-
that array would be coming from an external API Post Request. So basically a simple array() that is provided and then used as an API Input in Xano.
Categories
- All Categories
- 53 ? Announcements
- 47 ? Releases
- 37 ? Welcome
- 983 ? Help! I'm a Noob
- 125 ? No-Code Front-Ends
- 633 ? Working with APIs
- 439 ? Transforming data
- 126 ? Connect Xano to ...
- 50 ?? Find an Expert
- 348 ❓Other questions
- 35 ? Security
- 22 ✂️ Snippets
- 19 ? Showcase
- 7 ?️ Xano Chatter
- 62 ? Video Tutorials
- 171 ? Request a feature
- 229 ? Report a Bug
- 19 ? Templates & Extensions
- 7 ? Feedback