我有这样的代码。不知何故,我使用for循环简化了它。
cd
我想使用for循环让它像这样工作
if set(u) & set(s1):
u = u-s1
print('s1')
if set(u) & set(s2):
u = u-s2
print('s2')
if set(u) & set(s3):
u = u-s3
print('s3')
if set(u) & set(s4):
u = u-s4
print('s4')
if set(u) & set(s5):
u = u-s5
print('s5')
if set(u) & set(s6):
u = u-s6
print('s6')
答案 0 :(得分:0)
这样做你想要的吗?
select
b.PortID,
max(endversion) as EndVersion,
d.ShortName as RuleName
from xr.ObjectPropertyValue a
join moxyportfolio b
on a.objectid = b.portkey
join xr.AssignAllObjectsRule c
on a.Objectclassid = c.ObjectClassID -- can replace with xr.assignobjectrule if it's rule is not assigned to all portfolios.
join xr.rulebase d
on c.RuleID = d.RuleID
group by a.ObjectId, b.portid, d.ShortName
having sum(case when endversion is null then 1 else 0 end) = 0