Left join with condition

后端 未结 6 1016
没有蜡笔的小新
没有蜡笔的小新 2020-12-29 21:17

Suppose I have these tables

create table bug (
    id int primary key, 
    name varchar(20)
)
create table blocking (
    pk int primary key,
    id int, 
          


        
6条回答
  •  天涯浪人
    2020-12-29 22:03

    Simply put the "qa bug" criteria in the join:

    select t1.*, t2.name from #bug t1 
    left join #blocking t2 on t1.id = t2.id AND t2.name = 'qa bug'
    

提交回复
热议问题