Answer the question
In order to leave comments, you need to log in
How to use OR in sequelize?
I am writing a CRM system. There are 2 tables: in one users (parents), in another children. The child has 2 columns for parents (mom, dad).
The question is, how do I get the right child if the parent can be in one of the child's two fields? I used findOne() before, is it possible to use or here?
Answer the question
In order to leave comments, you need to log in
create a Relationships table instead of parent1, parent2:
Autokey, PersonAID, PersonBID, RelationType
then you can add any type of relationship PersonAID to PersonBID, not only for User to Children but also User to User and even Children to Children
Where in your case there will be 2 records with different User.ID and the same Children.ID
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question