0

I am trying to join three tables in SQL. I am using the following query but it is not working

select *
from char_level as c1 right join (SELECT distinct character_id as fid, target_character_dbid as tid  FROM house 
where reason='set_house_access' or reason='remove_house_access' and character_id is not null and target_character_dbid is not null)as vd on c1.character_id==vd.fid left join char_level as c2 on c2.character_id==vd.tid

can anyone help?

4

1 回答 1

2

添加分号并使用单个等号。

select *
from char_level c1 
right join 
(SELECT distinct character_id as fid, target_character_dbid as tid  
FROM house 
where (reason = 'set_house_access' 
or reason = 'remove_house_access') 
and character_id is not null 
and target_character_dbid is not null) vd 
on c1.character_id = vd.fid 
left join char_level c2 
on c2.character_id = vd.tid;
于 2013-05-13T20:43:20.610 回答