Access 2016选择查询重复字段值

时间:2018-10-09 22:44:00

标签: sql ms-access

我正在尝试在MS Access 2016中进行查询,并具有如下三个表:

BIB_TEXT
BIB_ID          AUTHOR          TITLE
255591          Ratnavi         saha Tamara
459194          Kantaiya        Akam elements
123456          Bob             Rules of Football   

BIB_MASTER
BIB_ID          SUPPRESS_IN_OPAC
255591          N
459194          N
123456          Y

BIB_INDEX
BIB_ID          INDEX_CODE      NORMAL_HEADING
255591          600H            Ilangaratna, 1913-1992
255591          600H            Tamara
459194          600H            Campantar
459194          600H            Tevaram
459194          600H            Cuntarar
459194          600H            Siva in Literature
123456          600H            Football United States
123456          600H            Football Rules

我得到的是什么

BIB_ID  AUTHOR          TITLE           NORMAL_HEADING
255591  Ratnavi         saha Tamara     Ilangaratna, 1913-1992
255591  Ratnavi         saha Tamara     Ilangaratna, 1913-1992
459194  Kantaiya        Akam elements   Campantar   
459194  Kantaiya        Akam elements   Campantar   
459194  Kantaiya        Akam elements   Campantar   
459194  Kantaiya        Akam elements   Campantar   

我想要得到什么:

BIB_ID  AUTHOR          TITLE           NORMAL_HEADING
255591  Ratnavi         saha Tamara     Ilangaratna, 1913-1992
255591  Ratnavi         saha Tamara     Tamara
459194  Kantaiya        Akam elements   Campantar   
459194  Kantaiya        Akam elements   Tevaram 
459194  Kantaiya        Akam elements   Cuntarar    
459194  Kantaiya        Akam elements   Siva in Literature

我怀疑这与联接有关,但是无论我进行什么更改,我都无法获取它来拉动所有NORMAL_HEADING值。这是SQL:

SELECT 
BIB_TEXT.BIB_ID, BIB_TEXT.AUTHOR, BIB_TEXT.TITLE, BIB_INDEX.NORMAL_HEADING
FROM 
(BIB_TEXT INNER JOIN BIB_MASTER ON BIB_TEXT.BIB_ID = BIB_MASTER.BIB_ID) INNER JOIN BIB_INDEX ON BIB_MASTER.BIB_ID = BIB_INDEX.BIB_ID
WHERE 
(((BIB_INDEX.INDEX_CODE)="600H") AND ((BIB_MASTER.SUPPRESS_IN_OPAC)="N"));

您的任何建议将不胜感激。

谢谢, 桑迪

0 个答案:

没有答案