Skip to content
Advertisement

Need help in joining two tables from mysql database for a photography project

I am working on a photography project and I am facing a bit issue with joining tables and retrieving data from mysql database. I have created two tables for this project. One table named cm_team is for team members and another table named cm_events for photography events..Assume to shoot a event, we require 6 persons and the id of the person is stored in cm_events table.
enter image description here enter image description here

As you can see from the above images.. I am storing the id’s of members of cm_team in cm_events table.. I wish to obtain the name of the team member in the respective highlighted fields in the cm_events table..Any help is highly appreciated.

for example my desired output should be: instead of 5 under team_lead heading, I should get the name corresponding to 5 i.e Arjun

Advertisement

Answer

Something like this? (cleaner and faster than subqueries)

JavaScript
User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement