(Untitled)
Options
![Niraj Chourasia](https://us.v-cdn.net/6037124/user_avatars/1901481.jpg)
Niraj Chourasia
Member ✭
Hi there,
I have 2 tables A and B. I need to gets all records of table A which does not exists in table B.
I could'nt get the way to do this. Please guide me to achieve it.
Thanks
I have 2 tables A and B. I need to gets all records of table A which does not exists in table B.
I could'nt get the way to do this. Please guide me to achieve it.
Thanks
Comments
-
Hi Niraj,
Community member here. I’m not sure of the best way with limited details and context. But, assuming there is a field with unique values in table A that matches a field in table B. I would start with adding a query all records function to your stack.
(“+” > Database Requests > Query all Records > table A)
Then, in the Filter tab add table B “by joins” no conditionals needed. Hit save.
Then add a conditional “by custom query” where tableA.matching_field does not equal tableB.matching_field. Hit save.
That should return an array of what I think you are looking for.
Lastly, I would also check out this great video that shows the true potential of add-ons and joins.https://youtu.be/3T8DQ6aAQBw
-
Hi ,
table A unique id field is used as foreign key in table B as user id -
Hi ,
I tried according to your suggestion but could'nt succeed, query always returing all records of table A
[Xano (6).png] -
anybody can look into this ?
-
Hey my bad I thought because it works with equals it would work with not equals. But, that’s not how joins work.
So what you want to do is add table B as a “left” join. Then add the conditional to that join where table A.id = table B.user_id. Then add custom query where table B.user_id = null. (Just tested and it worked.)
[F03649FC-ACDB-4B81-96BC-CAA5166428DD]
As far I understand this will create a table “a” with all records of tableA (which is why we kept getting all the records) joined with the matching records in B based on the conditional set. If there is no match it will add null match. -
Thank you for this contribution!
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