我是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';
使用join而不是在from子句中选择它。