I have two tables that I am joining with the following query...
select *
from Partners p
inner join OrganizationMembers om on p.ParID = om.OrganizationId
where om.EmailAddress = '[email protected]'
and om.deleted = 0
Which works great but some of the columns from Partners
I want to be replaced with similarly named columns from OrganizationMembers
. The number of columns I want to replace in the joined table are very few, shouldn't be more than 3.
It is possible to get the result I want by selectively choosing the columns I want in the resulting join like so...
select om.MemberID,
p.ParID,
p.Levelz,
p.encryptedSecureToken,
p.PartnerGroupName,
om.EmailAddress,
om.FirstName,
om.LastName
from Partners p
inner join OrganizationMembers om on p.ParID = om.OrganizationId
where om.EmailAddress = '[email protected]'
and om.deleted = 0
But this creates a very long sequence of select p.a, p.b, p.c, p.d, ... etc ...
which I am trying to avoid.
In summary I am trying to get several columns from the Partners
table and up to 3 columns from the OrganizationMembers
table without having a long column specification sequence at the beginning of the query. Is it possible or am I just dreaming?