i'm doing a school schedule and i have this:


as you can see i have the times on the first column and that is from table "tempos_letivos".

now i have a "schedule" table where is the hours of class of the courses, but in this table the cod_prof and cod_curso and i want the names...which are in the "profs" table (cod_prof) and the "course" table (cod_curso).

I'm thinking about the INNER JOIN, but i don't know how

can someone help me put the code, please?

Thank you

If you are needing to combine the data across those three tables you will need to do a join. Can you post up the actual structure of each table? That way we can help you more, at the moment we would just be guessing about the columns.





OK, a basic join would look like this:

SELECT name_prof, name_course FROM profs join courses on profs.cod_course = courses.cod_course order by name_prof;

When doing joins you need to specify with the ON clause which columns in each table form the linkage. And if you refer to a column that occurs in both tables you need to fully qualify it as tableName.columnName.

Can you help me doing the code i never worked with sql so i don't know the operations i have to call and stuff like that :S

If you could help me, it would be awesome.

Thank you

This question has already been answered. Start a new discussion instead.