jeudi 21 juillet 2016

Joining tables and displaying columns with different conditions

I have 2 tables: CTU contains columns 'course_id', 'user_id', and 'date' NU contains columns 'name' and 'id' user_id in table CTU has the same info as 'id' in table NU. I want my output to display the following: name | date where course_id = 1 | date where course_id = 2 I can get the first 2 columns to appear with a simple query, but I don't understand SQL JOIN's and subqueries very well so I'm having a hard time getting the last column to display.

Aucun commentaire:

Enregistrer un commentaire