January 25, 2003 at 12:00 am
Comments posted to this topic are about the content posted at http://www.sqlservercentral.com/columnists/ccubley/usingexoticjoinsinsqlpart2.asp
Chris Cubley
www.queryplan.com
February 5, 2003 at 11:32 pm
Good article with valuable information, but it appears that this has a repeated typo. Shouldn't s.RoomNumber = s.RoomNumber be s.RoomNumber = c.RoomNumber?
February 11, 2003 at 1:34 pm
Is there an advantage in putting the inequality in the join statement rather than in a WHERE clause? Does the query run faster?
example:
SELECT s.CourseID,s.SectionNumber,
c.RoomCapacity, s.SectionCapacity
FROM tb_ClassSection s
INNER JOIN tb_Classroom c
ON ( s.BuildingName = c.BuildingName
AND s.RoomNumber = s.RoomNumber)
WHERE c.RoomCapacity < s.SectionCapacity
June 26, 2003 at 7:18 am
quote:
Is there an advantage in putting the inequality in the join statement rather than in a WHERE clause? Does the query run faster?example:
SELECT s.CourseID,s.SectionNumber,
c.RoomCapacity, s.SectionCapacity
FROM tb_ClassSection s
INNER JOIN tb_Classroom c
ON ( s.BuildingName = c.BuildingName
AND s.RoomNumber = s.RoomNumber)
WHERE c.RoomCapacity < s.SectionCapacity
That would be my questions too. Too bad there's no answer.
June 26, 2003 at 3:07 pm
I don't know of any performance difference from putting the join criteria of an inner join into the where clause rather than the from clause. However, I always put join criteria (comparisons between columns of tables) in the from clause for consistency's sake because there IS a difference when it comes to outer joins. By doing it the same for inner and outer joins, things are easier down the road if you need to change the code.
Chris Cubley
quote:
quote:
Is there an advantage in putting the inequality in the join statement rather than in a WHERE clause? Does the query run faster?example:
SELECT s.CourseID,s.SectionNumber,
c.RoomCapacity, s.SectionCapacity
FROM tb_ClassSection s
INNER JOIN tb_Classroom c
ON ( s.BuildingName = c.BuildingName
AND s.RoomNumber = s.RoomNumber)
WHERE c.RoomCapacity < s.SectionCapacity
That would be my questions too. Too bad there's no answer.
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply