C# 基于多列的打印值

C# 基于多列的打印值,c#,sql,asp.net,linq-to-sql,C#,Sql,Asp.net,Linq To Sql,我的桌子 +----+----------+---------+---------+----------+ | ID | State A | State B | State C | Duration | +----+----------+---------+---------+----------+ | 1 | a | a | a | 12 | +----+----------+---------+---------+----------+

我的桌子

+----+----------+---------+---------+----------+
| ID | State A  | State B | State C | Duration |
+----+----------+---------+---------+----------+
| 1  |     a    |    a    |    a    |    12    |
+----+----------+---------+---------+----------+
| 2  |     a    |    a    |    a    |    15    |
+----+----------+---------+---------+----------+
| 3  |     a    |    a    |    b    |    12    |
+----+----------+---------+---------+----------+
| 4  |     a    |    b    |    b    |    30    |
+----+----------+---------+---------+----------+
| 5  |     b    |    b    |    b    |    12    |
+----+----------+---------+---------+----------+

如果这3列的值和持续时间相同,则这是一个过滤器以及
concat()

select concat(statea,“是赢家”)
从t
其中statea=stateb,stateb=statec,持续时间<15

与您所写的一模一样:这三列的值和持续时间都相同<15:
其中stata_A=stateB和stateB=stateC amd duration<15
其他行呢您在寻找linq或SQL解决方案吗?如果linq您尝试过什么吗?然后将WHERE条件移动到Select:
案例中,当stata_A=stateB和stateB=stateC且持续时间<15时,则“是赢家”否则“结束”
如果状态A=1如果状态b=1,则状态c=1我希望显示一些文本
+----+-----------------+
| ID |    THE RESULT   |
+----+-----------------+
|  1 | a is the winner |
+----+-----------------+
select concat(statea, ' is the winner')
from t
where statea = stateb and stateb = statec and duration < 15