2016-10-18 62 views
0

我是SQL新手,我正在使用Oracle Apex。我試圖運行以下查詢:我不斷收到重複結果

Select COMPANIES.COMP_NO as "Company Id", COMP_NAME as Company", 
OPEN_START_DATE as "Start Date", OPEN_TITLE as "Opening Title", 
QF_CODE as "Required Qualification" 
From OPENINGS, COMPANIES 
Where COMP_ADDRESS='Auckland' 
AND OPEN_START_DATE Between '12/01/2016' AND '12/31/2016'; 

我知道應該只有四個返回的結果,但我不斷得到相同條目的重複。我究竟做錯了什麼??我相信它必須與我的表連接有關...謝謝

+0

請發表兩張表的結構。 –

回答

0
select 
    c.comp_no, 
    c.comp_name, 
    o.start_date, 
    o.open_title 
from 
    companies c 
    join openings o on o.comp_no=c.comp_no 
where 
    start_date between '2016-10-01' and '2016-10-07'; 

使用連接,而不是在from子句中選擇它。