面试题:查询所有上级SQL

 

[customer] 写错了,该写bossone

 

求 User10 User20 User30 User60 的所有上级

面试题:查询所有上级SQL

 

select a.id,a.[User] ,a.customer as bossone,bosstwo = b.[customer]

,bossthree = c.customer from tem a

left join tem b on a.customer = b.[user]

left join tem c on b.customer = c.[user]

where a.[User] = 'user10' or a.[User] = 'user20' or a.[User] = 'user30' or a.[User] = 'user60'

 

相关文章:

  • 2022-02-05
  • 2022-12-23
  • 2022-12-23
  • 2021-08-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-02-26
  • 2021-08-14
  • 2022-01-01
  • 2021-08-26
相关资源
相似解决方案