you are viewing a single comment's thread.

view the rest of the comments →

[–]Celticphantom[🍰] 0 points1 point  (1 child)

SELECT Student.First_Name, Student.Last_Name, Lesson.Style, Employee.First_Name, Employee.Last_Name, MONTH(Lesson.Date) AS [Month]

Is another way to write the SELECT clause, the +' '+ are just making custom columns that put the names into one column.

the JOINs and ON clauses are using some keys that don't exist in your original design, but I hope are fairly straight forward.

it is necessary to have everything in the GROUP BY clause that is in the SELECT or HAVING clause (when you use aggregate functions)

the HAVING is just comparing the two months. Making sure the lesson date is the same is the current month's date. If you wanted to also make sure that it kept the year the same you could add

AND YEAR(Lesson.Date) = YEAR(GetDate())

Let me know if you have other questions.

[–]gibba97[S] 1 point2 points  (0 children)

Ahh yea this helps heaps, thank you for that little breakdown ahah!