我在不同的日期有一个鱼cought表。Oracle在最短日期列表中的日期
表着陆:
Long ID,
Long Vessel_id, -- vessel that is fishing
TimeStamp fishing_date,
double amount_cought
Long species_id;
接下来是使用船只鱼公司的表。
表ves_usage:
Long ID,
TimeStamp usage_start_date,
TimeStamp usage_end_date,
Long vessel_id,
Long using_company_id;
最后我有执照的表中某一年以鱼为一家公司的具体种类。
表许可证:
Long ID,
int year, --the year that the lincence is active
Long licenced_company_id,--company who was given the licence
Long species_id; --species that the company can fish
我想选择所有从着陆表中有一个特定的物种,公司和船舶的记录。我遇到的问题是我不能想到一种方法来选择ves_usage表记录的开始日期和结束日期之间的所有着陆记录。不确定是不是我不够清楚:P 我想要的东西,如:
Select *
from landings
where fishing_date between <list of usage_start_date and usage_end_date from ves_usage table>
你需要做一个连接。 (或者有很多的或者是BETWEEN。) – jarlh
样本数据,尤其是期望的结果会让你清楚你想要完成什么。 –
那么你想要一个特定的公司(使用'using_company_id')完成的所有着陆或在特定旅程中完成的所有着陆(使用'ves_usage'表中的'id')吗?此外,你给了我们'licences'表;你有什么想做的吗? –