How do you select all fields of two joined tables, without having conflicts with the common field?
Suppose I have two tables, Products
and Services
. I would like to make a query like this:
SELECT Products.*, Services.*
FROM Products
INNER JOIN Services ON Products.IdService = Services.IdService
The problem with this query is that IdService
will appear twice and lead to a bunch of problems.
The alternative I found so far is to discriminate every field from Products
except the IdService
one. But this way I'll have to update the query every time I add a new field to Products
.
Is there a better way to do this?