Click here to Skip to main content
16,018,973 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
hi guys i have this data in my table
ID                     Date1                   ACC_NO                 Balance               Collector                                                                                                                                                                                                                                                       Call_Visit                                                                                                                                                                                                                                                      Trials                                                                                                                                                                                                                                                          PTP_Type                                                                                                                                                                                                                                                        PTP_Amount            Kept_Amount
---------------------- ----------------------- ---------------------- --------------------- --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- --------------------- ---------------------
5                      2013-08-01 00:00:00.000 12345680               80004.00              ahmed                                                                                                                                                                                                                                                           call                                                                                                                                                                                                                                                            Contact                                                                                                                                                                                                                                                         NULL                                                                                                                                                                                                                                                            NULL                  NULL
19                     2013-08-01 00:00:00.000 12345694               80018.00              mohamed                                                                                                                                                                                                                                                         call                                                                                                                                                                                                                                                            NA                                                                                                                                                                                                                                                              NULL                                                                                                                                                                                                                                                            NULL                  NULL
20                     2013-08-01 00:00:00.000 12345695               80019.00              mohamed                                                                                                                                                                                                                                                         visit                                                                                                                                                                                                                                                           PTP                                                                                                                                                                                                                                                             وعد بالدفع                                                                                                                                                                                                                                                      9000.00               9000.00
21                     2013-08-01 00:00:00.000 12345696               80020.00              wael                                                                                                                                                                                                                                                            visit                                                                                                                                                                                                                                                           UR                                                                                                                                                                                                                                                              NULL                                                                                                                                                                                                                                                            NULL                  NULL
22                     2013-08-01 00:00:00.000 12345697               80021.00              ahmed                                                                                                                                                                                                                                                           call                                                                                                                                                                                                                                                            WN                                                                                                                                                                                                                                                              NULL                                                                                                                                                                                                                                                            NULL                  NULL
23                     2013-08-01 00:00:00.000 12345698               80022.00              ahmed                                                                                                                                                                                                                                                           call                                                                                                                                                                                                                                                            LM                                                                                                                                                                                                                                                              NULL                                                                                                                                                                                                                                                            NULL                  NULL


I need to get result after use query in one row per date like this
Date1 = 2013-08-01
Count ACC_No = 6 [ no duplicate ]
Sum Balance = 480104
Count Collector = 3 [ no duplicate]
Count Call_Visit = 2 where it equal [ visit ]
Count Trials = 1 where it equal [ contact ]
Count PTP_Type = 1 where it [ not null ]
Count PTP_Amount = 1 where it [ "وعد بالدفع" ]
Sum PTP_Amount = 9000.00 [ sum all data in column ]
Sum Kept_Amount = 9000.00 [ sum all data in column ]
Posted
Comments
Ahmed Emad 8-Nov-13 15:38pm    
Sorry guys this xps file for table result in date 2013-08-01
https://www.dropbox.com/s/ykqi4nbucu24i5l/ex.xps

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