访问查询以包括所有记录,即使一个字段缺少数据(为空)

时间:2017-01-27 17:06:18

标签: sql ms-access null

我正在尝试运行查询以包含所有记录。如果其中一个字段为空,则省略记录。将查询属性中的“输出所有字段”更改为“是”会带来所有字段,但这不是我需要的。我需要所有记录。这是我的SQL查询:

SELECT tblBOOK.Concat, tblBOOK.Owner1, tblBOOK.Owner2, 
tblIndustry.[Industry Name], tblOwner1.Points, tblOwner2.Points, 
tblIndustry.[Industry Points], tblBOOK.FILE, tblBOOK.SCORE, 
tblFILE.Points, tblSCORE.Points, tblBOOK.Risk, tblRisk.Points,
[tblOwner1]![Points]+[tblOwner2]![Points]+[Industry Points]+
[tblFILE]!  [Points]+[tblSCORE]![Points]+[tblRisk]![Points] 
AS TtlPoints

FROM tblRisk 
INNER JOIN (tblSCORE 
INNER JOIN (tblFILE 
INNER JOIN ((tblOwner1 
INNER JOIN (tblOwner2 
INNER JOIN tblBOOK 

ON (tblOwner2.Secondary = tblBOOK.Owner2) 
AND (tblOwner2.Primary = tblBOOK.Owner1)) 

ON tblOwner1.Primary = tblOwner2.Primary) 
INNER JOIN tblIndustry 
ON tblBOOK.Industry = tblIndustry.[Industry Name]) 
ON tblFILE.Score = tblBOOK.FILE) 
ON tblSCORE.Score = tblBOOK.SCORE) 
ON tblRisk.Factor = tblBOOK.Risk;

我还尝试将“IsNull”添加到条件中,然后返回没有记录。

1 个答案:

答案 0 :(得分:0)

我需要将这些从INNER JOINS改为LEFT JOINS

bt_fb.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
isFacebook= true;`

}

bt_twitter.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
isFacebook= false;`

}