drift icon indicating copy to clipboard operation
drift copied to clipboard

How to apply inner join for four tables?

Open pranay2210 opened this issue 5 years ago • 5 comments

pranay2210 avatar Jan 26 '20 14:01 pranay2210

You you just use

select(firstTable).join([
  innerJoin(secondTable, condition),
  innerJoin(thirdTable, condition),
  innerJoin(fourthTable, condition),
])

Do you need anything special I'm missing?

simolus3 avatar Jan 26 '20 15:01 simolus3

Could you please provide me an example so that I could find it more clear to use. Thank you

pranay2210 avatar Jan 26 '20 15:01 pranay2210

You you just use

select(firstTable).join([
  innerJoin(secondTable, condition),
  innerJoin(thirdTable, condition),
  innerJoin(fourthTable, condition),
])

Do you need anything special I'm missing?

And when I have three many-to-many relationships and one to many relationships. How to make this inner join?

DougSiqueira avatar Jan 26 '20 17:01 DougSiqueira

It is related to my problem: #345

DougSiqueira avatar Jan 27 '20 01:01 DougSiqueira

@pranay2210 Can you describe your scenario some more? Like what kind of tables you have and what query you need. If I know more about your use case I can write a fitting example.

simolus3 avatar Feb 10 '20 18:02 simolus3