如何在C#中找到特定的coumn值 [英] How to find the particular coumn value in C#

查看:105
本文介绍了如何在C#中找到特定的coumn值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的桌子价值如下





Productid Slipno Code Qty



1 225 A 5

2 225 B 10

3 100 C 20

4 50 D 25

5 70 E 30

6 150 F 10

7 150 G 10



i想要写sql server,如果slip没有值出现两次。



在上面的两个滑动没有值出现过两次,在sql server中得到低于输出的怎么写查询< br $>


i希望获得以下输出



Productid Slipno Code Qty



1 225 A 5

2 225 B 10

6 150 F 10

7 150 G 10


我尝试过:



我有价值表如下:





Productid Slipno代码数量



1 225 A 5

2 225 B 10

3 100 C 20

4 50 D 25

5 70 E 30

6 150 F 10

7 150 G 10



i想写sql server,如果滑动没有值出现两次。



在上面的两个滑动没有值出现过两次,因为在sql server中得到低于输出的怎么写查询



i希望获得以下输出



Productid Slipno Code Qty



1 225 A 5

2 225 B 10

6 150 F 10

7 150 G 10

I have table with value as follows


Productid Slipno Code Qty

1 225 A 5
2 225 B 10
3 100 C 20
4 50 D 25
5 70 E 30
6 150 F 10
7 150 G 10

i want to write the sql server, if slip no value appeared twice.

in the above two slip no values has appeared twice, for getting below output in sql server how to write the query

i want to get the below output

Productid Slipno Code Qty

1 225 A 5
2 225 B 10
6 150 F 10
7 150 G 10

What I have tried:

I have table with value as follows


Productid Slipno Code Qty

1 225 A 5
2 225 B 10
3 100 C 20
4 50 D 25
5 70 E 30
6 150 F 10
7 150 G 10

i want to write the sql server, if slip no value appeared twice.

in the above two slip no values has appeared twice, for getting below output in sql server how to write the query

i want to get the below output

Productid Slipno Code Qty

1 225 A 5
2 225 B 10
6 150 F 10
7 150 G 10

推荐答案

尝试:

Try:
SELECT a.ProductID, a.SlipNo, a.Code, a.Qty
FROM (SELECT SlipNo, COUNT(SlipNo) AS cnt
     FROM MyTable
     GROUP BY SlipNo
     HAVING COUNT(SLIPNO) > 1) g
JOIN MyTable a
ON a.SlipNo = g.SlipNo


这篇关于如何在C#中找到特定的coumn值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆