Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/visual-studio-2012/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Sql 不要在LoV中包含第二个表中已经使用的车辆编号_Sql_Oracle_Oracle11g_Oracle Apex - Fatal编程技术网

Sql 不要在LoV中包含第二个表中已经使用的车辆编号

Sql 不要在LoV中包含第二个表中已经使用的车辆编号,sql,oracle,oracle11g,oracle-apex,Sql,Oracle,Oracle11g,Oracle Apex,我有两张表,在一张“车号”表中,我有一张车号列表。在第二个表“登记号码”中,我在那里登记了汽车号码。在“注册号码”表中,我使用取自“号码表”表的LOV列表填写表格。是否可以确保在LOV列表中填写“注册号码”时,表格中只有以前未注册过的号码。从现在起,“汽车号码”表中的所有号码都出现在列表中。(谢谢你的帮助) 不存在(或不在)可能会有所帮助 select c.car_number d, c.id r from number_car c where not exists (se

我有两张表,在一张“车号”表中,我有一张车号列表。在第二个表“登记号码”中,我在那里登记了汽车号码。在“注册号码”表中,我使用取自“号码表”表的LOV列表填写表格。是否可以确保在LOV列表中填写“注册号码”时,表格中只有以前未注册过的号码。从现在起,“汽车号码”表中的所有号码都出现在列表中。(谢谢你的帮助)

不存在
(或
不在
)可能会有所帮助

select c.car_number d,
       c.id     r
from number_car c
where not exists (select null 
                  from registered_numbers r
                  where r.id = c.id
                 )
order by c.car_number;

我将
number
列重命名为
car\u number
,因为
number
是为数据类型名称保留的,不能用作列名(好的,可以,但不应该是。提示:双引号)。

并且我们不检查相似的列注册号?如果ID列执行此任务,则无需检查。如果没有,请使用您认为合适的列。您发布了两条CREATETABLE语句,没有外键,没有列描述,因此我们只能猜测是什么。Littlefoot,谢谢您的帮助!)你在apex很有理解力。你可以再帮我一个问题,你可能知道如何实现它)不客气。为了防止您没有注意到,这里的良好实践——堆栈溢出——是向上投票或接受您认为有用的答案。Littlefoot,并且可以在表“number\u car”中添加“Used”列,如果在“registered\u numbers”中使用数字,则在报告“number\u car”中,在“Used”的对面写上“Used”,如果没有,则写上“not Used”???我的报告请求如下所示:“选择id、编号、使用、日期\u从编号\u车添加”
select c.car_number d,
       c.id     r
from number_car c
where not exists (select null 
                  from registered_numbers r
                  where r.id = c.id
                 )
order by c.car_number;