tl;dr
The short answer is no. You have to do the multiple join, even if you only want columns from the two tables 'on each side'.
Table design
This seems like a pain, but although it makes your queries longer, it is much more important to get the database structure, including foreign keys right, than it is to make queries short.
There are a couple of ways of arranging foreign keys, sometimes with extra tables which are only there to express relations. For example, if every Cat has a unique Mouse, there could be a foreign key from Cat to Mouse with a unique constraint. It could even be the primary key of Cat. If every Cat has zero or more Mouses, but no Mouse having more than one Cat, you would have a usual foreign key from Mouse to Cat. If every Cat has zero or more Mouses, and every Mouse has zero or more Cats, you would create a third table CatMouseMatching, which has an entry for each 'edge' between a Cat and a Mouse, with foreign keys to the Cat and the Mouse. You will learn that these patterns are very important and the basic cases cover a lot of situations.
Now, suppose that you reverse the foreign keys in your table design, so that Utilizadors
and Areas
both have a foreign key to Permissoes
. This would mean that you could simplify the join - because you could filter on permissoe_id
being equal in both tables. However, this would be a quite strange relationship between Utilizador
and Area
which might not correspond to reality. You might have an Utilizador
associated with a Permissoe
which did not have any Area
linked to it. This Utilizador
would just disappear from the inner join.
This might only make sense if there was some real entity which formed the link between the two entities. For example, every Cat lives in a House, and every Mouse lives in a House. You can easily find the Cat-Mouse pairs which live in the same House.
Practical tips
You could always create a VIEW, which makes a common query act like a table. Your query above could be defined as the view, and then other queries could select from it and join to it, without having to understand what joins make up the view internally.
If you don't create a view, you might at least save the snippet of code which does the join, so that you can paste it into other similar queries later.