简体   繁体   English

如何为该表构建子查询?

[英]How do I structure a sub query for this table?

I have a table that will always have a row for the en-US culture.我有一张桌子,总是有一行代表美国文化。 I am trying to write a query that will give me results for rows that do not also contain es or fr-CA.我正在尝试编写一个查询,该查询将为我提供不包含 es 或 fr-CA 的行的结果。 Could anyone point me in the right direction?谁能指出我正确的方向?

TextKey文本键 Culture文化
DutyType.SigningCeremonyOnly DutyType.SigningCeremonyOnly en-US zh-CN
DutyType.SigningCeremonyOnly DutyType.SigningCeremonyOnly es es
DutyType.SubmitOnly DutyType.SubmitOnly es es
DutyType.SubmitOnly DutyType.SubmitOnly en-US zh-CN
DutyType.SubmitOnly DutyType.SubmitOnly fr-CA FR-CA

You seem to be asking for:您似乎在要求:

select t.*
from t
where not exists (select 1
                  from t t2
                  where t2.textkey = t.textkey and t2.culture in ('es', 'fr-CA')
                 );

I'm not sure why it is relevant that rows exist for en-US .我不确定为什么en-US存在行是相关的。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM