如何在sql查询中选择使用条件

时间:2015-08-03 13:49:48

标签: sql database join conditional-statements

我想在sql multiple和using condition中创建select查询,我的查询如下:

select a.name, b.* from event a right join student b on a.id=b.id_place

从上面的查询我想显示表b中的所有列,当a.id!= 0的值时, 如何使用类似

的条件创建SQL查询

1 个答案:

答案 0 :(得分:0)

要向RIGHT OUTER JOIN查询添加条件,只需添加具有所需条件的WHERE子句。这是一个例子:

 select a.name, b.* 
 from event a right join student b on a.id=b.id_place 
 where a.id != 0