select 查询是否已分配给 orderno 不显示

select query for not to showing if already assigned to orderno

Supplier
S.No | Name
1    | Arun
2    | Ram
3    | Kishore

Response
S.No | OrderNo | Supplier
1    |     001 |        1
2    |     001 |        2
3    |     002 |        3
4    |     003 |        2

以上是我的Table。

我正在写一个自动建议选项。我需要一个条件查询,

如果为特定订单分配了供应商,则不应再次显示该订单

类似

select * from Supplierwhere (#don't know what to implement here)

我如何构建相应的 select 查询??

SELECT *
FROM supplier
WHERE S_No NOT IN (SELECT S_No FROM Response)

您可以使用更复杂的连接条件更有效地完成它。

试试这个..

SELECT S.No,Name FROM Supplier WHERE S.No NOT IN (SELECT Supplier FROM Response where OrderNo =001)