I'm using visual studio sql database to inner join 3 tables to one main table.
The main table is Event
and the PK_EventsID
is linked to the FK_EventsID
of the other 3 tables (StudentCompetition
, ImmersionTrip
, IndustryCollaboration
)
I tried using inner join with 2 tables (Event
and StudentCompetition
) and it works, but when I add another table (Event
, StudentCompetition
, ImmersionTrip
) it does not display anything even though there is an inner join. The column names appear, but the data doesn’t.
Similar column names are startDate
, endDate
and eventID
while the remaining are different. I would also like to know how to group similar column names together
I'm planning to join more then 10 tables together for a search function.
SQL Query
SELECT
Event.eventName,
Event.eventID,
StudentCompetition.competitionName,
ImmersionTrip.immersionName
FROM
Event
INNER JOIN StudentCompetition ON Event.eventID = StudentCompetition.eventID
INNER JOIN ImmersionTrip ON Event.eventID = ImmersionTrip.eventID