添加内部联接

时间:2016-12-15 21:38:59

标签: sql postgresql

我正在尝试将另一个内连接添加到我的sql查询中。我对SQL并不擅长并陷入困境:

select * 
  from applications 
  inner join all_applications on app.name = all_applications.application_id 
  where paid = true

并需要添加,

inner join subscriptions on applications.subname_id = subscriptions.id

如何使查询正常运行?

编辑:谢谢,使用错误的参考应用名称

2 个答案:

答案 0 :(得分:0)

在另一个内部联接

下添加联接
select * 
from applications 
  inner join stat_applications on applications.id = stat_applications.application_id
  inner join subscriptions on applications.subscription_id = subscriptions.id 
where enabled = true

答案 1 :(得分:0)

select * from applications 
     inner join 
      stat_applications on applications.id = stat_applications.application_id 
     inner join 
      subscriptions on applications.subscription_id = subscriptions.id
     where applications.enabled = true