问题描述:

select bcd from bcd22 where [email protected] group by bcd having count(bcd)%2=0

cmd22.Parameters.Add("@bcd1", SqlDbType.NChar, 20, "bcd").Value = textBox1.Text;


input set:

1000,1001,1003,1000


corresponding OUTPUT:

1001

1003

1000

1000


whereas I want the output to be as

1000

1001

1003

1000

without grouping

网友答案:

It looks to me like the output you're getting and the output you want are the same thing, with the exception of the order, and there's no guaranteed order for a query like the one you posted.

If you want a specific order, you can achieve that by adding an ORDER BY clause, but it's hard to provide much specific help on that without more information. For example, it looks like you want the output to be in the same order as the input, but I'm not quite clear where those input values are coming from. All I see is a single parameter in your query.

相关阅读:
Top