我有三张桌子
POS_ITEM ( have 4 columns [ITEM_col1,ITEM_col2,ITEM_col3,ITEM_col4])
POS_MAP ( have 3 columns [MAP_col1, MAP_col2,MAP_col3])
POS_DIS ( have 5 columns [DIS_col1,DIS_col2.DIS_col3,DIS_col4,DIS_col5])
我必须从POS_ITEM到POS_MAP执行left outer join
,这是我能够做到的。但是现在我必须将这个结果与第三个表POS_DIS结合起来。
我试过这个
select b.MAP_col2,a.ITEM_col1,a.ITEM_col2,a.ITEM_col3
FROM POS_ITEM as b
left outer JOIN POS_MAP as a on a.ITEM_col1=b.MAP_col2 as h
left Outer JOIN POS_DIS as d on d.DIS_col1=h.MAP_col2 ;
但它不起作用。
我试过这个
(select b.MAP_col2,a.ITEM_col1,a.ITEM_col2,a.ITEM_col3
FROM POS_ITEM as b
left outer JOIN POS_MAP as a on a.ITEM_col1=b.MAP_col2) as h
left Outer JOIN POS_DIS as d on d.DIS_col1=h.MAP_col2 ;
但这不能说“(”不是有效字符。
这对Sqlite来说不可能吗?如果是这样,我做错了什么?如果没有,我的替代方案是什么?
答案 0 :(得分:1)
终于破解了......结果将是追加......不需要添加大括号
select b.MAP_col2,a.ITEM_col1,a.ITEM_col2,a.ITEM_col3
FROM POS_ITEM as b
left outer JOIN POS_MAP as a on a.ITEM_col1=b.MAP_col2
left Outer JOIN POS_DIS as d on d.DIS_col1=b.MAP_col2 ;