Can the on in the join on query statement in mysql be changed to where?
Imhu2021-09-14 11:06:42
0
2
1320
For example: SELECT salary.`basesalary`,salary.`titlesalary`,`name`FROM salary INNER JOIN employeeWHERE salary.`empid`=employee.`empid` AND employee.sex='male'; this can also be checked Get the correct result
Let’s briefly talk about the difference between on and where. The cloud server I use is Xiaoniao Cloud. On is used when generating temporary tables. Because left on will return the left table regardless of whether the filter conditions in on are true or not. records in. For records that do not meet the conditions, all fields in the right table are null. Where works after the temporary table is generated to filter the temporary table. If the condition is not true at this time, all can be filtered.
Yes, the two methods are different. If there is on, the data rows will be retrieved from the employee table based on the on conditions, and then the matching will be completed. If there is where, the data will be filtered after the matching is completed.
Let’s briefly talk about the difference between on and where. The cloud server I use is Xiaoniao Cloud. On is used when generating temporary tables. Because left on will return the left table regardless of whether the filter conditions in on are true or not. records in. For records that do not meet the conditions, all fields in the right table are null. Where works after the temporary table is generated to filter the temporary table. If the condition is not true at this time, all can be filtered.
Yes, the two methods are different. If there is on, the data rows will be retrieved from the employee table based on the on conditions, and then the matching will be completed. If there is where, the data will be filtered after the matching is completed.