Hello Guys,
I need your small help to solve a issue i facing now.
my objective is to load data from database to gridview.
I want to count the account number how many times it is in the datatable.( the normal sql cell count in is not working here)
See the screenshot below.


Laxmidhar SahooRank #383 · 6.6K reputationPosted Nov 11, 2018, 10:38 PM EST
Bineesh ViswanathRank #1,681 · 907 reputationPosted Nov 12, 2018, 12:06 AM EST
SELECT tblActionDetails.CustomerID,FID, CONVERT(nvarchar(20), ActionDate, 103) as ActionDate,
REPLACE(SUBSTRING(CONVERT(nvarchar(128),ActionDate, 109), 12 , 128),':000', ' ') as ActionTime,
Status,CAST(CASE WHEN ContactNo2 != '' THEN ContactNo2 ELSE ContactNo1 END AS varchar) as Mobile into #CustDetails
from tblActionDetails inner join tblCustomer on tblCustomer.CustomerID=tblActionDetails.CustomerID
where ActionDate between CONVERT(datetime,'11/11/2018',103)and CONVERT(datetime,'12/11/2018',103)
and Area='OUTBOUND_CALL' and tblCustomer.Status='Ringing' order by FID desc
select #CustDetails.CustomerID,
#CustDetails.ActionDate, #CustDetails.ActionTime,#CustDetails.Status,#CustDetails.Mobile
from #CustDetails order by FID desc
drop table #CustDetails
and the output is:-