using where and inner join in mysql

前端 未结 4 1746
攒了一身酷
攒了一身酷 2020-12-08 13:56

I have three tables.

locations

ID   | NAME | TYPE |
1    | add1 | stat |
2    | add2 | coun | 
3    | add3 | coun |
4    | add4 | co         


        
4条回答
  •  轮回少年
    2020-12-08 14:33

        SELECT `locations`.`name`
          FROM `locations`
    INNER JOIN `school_locations`
            ON `locations`.`id` = `school_locations`.`location_id`
    INNER JOIN `schools`
            ON `school_locations`.`school_id` = `schools_id`
         WHERE `type` = 'coun';
    

    the WHERE clause has to be at the end of the statement

提交回复
热议问题