Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is seven inner joins in a query too much?

Tags:

sql

inner-join

I have a query that has 7 inner joins (because a lot of the information is distributed in other tables), a few coworkers have been surprised. I was wondering if they should be surprised or is having 7 inner joins normal?

like image 839
seFausto Avatar asked Oct 31 '08 19:10

seFausto


2 Answers

it's not unheard of, but I would place it into a view for ease of use, and maintenance

like image 102
Stephen Wrighton Avatar answered Sep 27 '22 22:09

Stephen Wrighton


Two questions:

  1. Does it work?
  2. Can you explain it?

If so, then seven is fine. If you can't explain the query, then seven is too many.

like image 43
S.Lott Avatar answered Sep 27 '22 22:09

S.Lott