Reputation: 51
I have a table follow this:
Ord_no | Share_no
1 1160
1 1160
2 1170
3 1160
3 1170
I want to count of difference of Ord_no
with same Share_no
record.
for example :
Count Share_no=1160 ~~> 2
Count Share_no=1170 ~~> 2
I use C# .net and want to pass 1160 record ,to database with a stored procedure and give '2' as a query result.
"select count(*), share_no from ord_tbl where share_no=@share_no group by share_no"
Upvotes: 1
Views: 4827
Reputation: 1042
I assume you table name test and the answer should be :
select count(*), share_no from test group by share_no;
Upvotes: 1