Mysql query with Left Join is too very slow

后端 未结 6 1329
萌比男神i
萌比男神i 2021-02-13 16:09

Query:

   select `r`.`id` as `id` 
     from `tbl_rls` as `r` 
left join `tblc_comment_manager` as `cm` on `cm`.`rlsc_id` != `r`.`id`

Both tabl

6条回答
  •  半阙折子戏
    2021-02-13 16:47

    Looks like you are wanting the r.id values that are not in the tblc_comment_manager table.

    Use a Not In

    select r.id as id
    from tbl_rls as r
    where r.id not in (select distinct cm.rlsc_id from tblc_comment_manager as cm)

提交回复
热议问题