Click here to Skip to main content
15,887,683 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
i have many payment rows in same date and i want to count how many payments i this date and put count result in new 1 row

i'm made it manually by excel but i want make it in c# with SQL Server & Data Grid View

this 2 photos will make you understanding
https://i.imgur.com/J7tRKjk.jpg
https://i.imgur.com/8B7JeQY.jpg


What I have tried:

i have tried many codes , many ways without results
Posted
Updated 23-Oct-19 22:41pm
Comments
CHill60 24-Oct-19 4:38am    
We rarely follow links in questions. That site is blocked at my work anyway.

Explain what you are trying to do clearly - in your native language first then use something like Google Translate to get it into English.

You should also share the code that you have tried - I can't see the relevance of a DataGridView to be honest.

In the meantime you might find this useful SQL GROUP BY | COUNT | Examples[^]
Mostafa Mohamed 24-Oct-19 4:48am    
sorry for put links but i make it for people know what i mean
CHill60 24-Oct-19 8:34am    
Nothing in those images makes your requirement any clearer than something you could have typed into your question
Richard Deeming 24-Oct-19 6:25am    
REPOST
You have already posted this in the C# forum, and been given the answer:
i want count rows per same date in new one row. c# with sqlserver - C# Discussion Boards[^]

1 solution

Try:
SQL
SELECT MyDateField, COUNT(MyDateField)
FROM MyTable
GROUP BY MyDateField
 
Share this answer
 
Comments
Mostafa Mohamed 24-Oct-19 4:47am    
29/01/2019
29/01/2019 is 2 row
30/01/2019
30/01/2019
30/01/2019 is 3 row

i want make it like that

29/01/2019 | 2
30/01/2019 | 3

i want make new column for counting
OriginalGriff 24-Oct-19 5:12am    
So try what I gave you ...
Mostafa Mohamed 24-Oct-19 6:13am    
thank you :D
OriginalGriff 24-Oct-19 6:30am    
You're welcome!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900