我可以为我的SSRS报告编写简单的SELECT语句,但是我试图弄清楚如何进行此查询并且我很难过。我有一个表,它有一个条目向我显示特定的过程已完成。这个过程是Operation_Seq_NO 60,QTY_GOOD是1.对于operation_seq_no,没有输入80,所以它继续报告。一旦80条记录进入桌面,它就需要退出报告。听起来很简单但完全让我感到困惑..我附上了一张图片或表格格式,可能有助于某人理解这个问题。任何帮助将不胜感激。感谢。
答案 0 :(得分:1)
您可以使用not exists()
或not in()
来过滤具有operation_sec_no = 80
对应行的行,如下所示:
使用not exists()
:
select *
from labor_ticket as t
where not exists (
select 1
from labor_ticket as as i
where t.transaction_id = i.transaction_id
and i.operation_sec_no = 80
)
或not in()
:
select *
from labor_ticket as t
where transaction_id not in (
select transaction_id
from labor_ticket as i
where i.operation_sec_no = 80
)