[T-SQL] Another grouping problem |
Posted: 09 May 2013 10:34 PM PDT I have found a bug in my duplicate macthing application and I believe it's with the way I group my records at the end of the matching process.Consider the following example (details are not real!)[img]http://i.imgur.com/zZy2PqS.jpg[/img]52941 matches 8388 and 15799 because mobile number and name is the same80833 matches 8388 and 15799 because name and address matchso this is same as saying 80833 matches 52941, 8388 AND 15799So based on the second result set, I would like to perform a grouping of the outcome to look like this:[img]http://i.imgur.com/NibYbnP.jpg[/img]NOTE, I picked the highest value ID as my Base or Group ID.Any suggestions? |
Posted: 24 Jun 2013 11:04 PM PDT Table1 Callstatusflag Generateddate N 2013-06-24 00:00:00.000 N 2013-06-24 00:00:00.000 B 2013-06-22 00:00:00.000 C 2013-06-22 00:00:00.000select count(Call_status_flag) Total from Table1 where '2013-06-22 00:00:00.000'>='2013-06-22 00:00:00.000' and Call_status_flag='N' O/P:2select count(Call_status_flag) Total from Table1 where Generateddate='2013-06-22 00:00:00.000' and Call_status_flag='N' O/P:0Why? |
Posted: 24 Jun 2013 07:40 PM PDT I search for Date functions for finding the max of the 2 dates. But such function does not exits.Is there any easy way to do it.Thanks in advance. |
You are subscribed to email updates from SQLServerCentral / SQL Server 2008 / T-SQL (SS2K8) To stop receiving these emails, you may unsubscribe now. | Email delivery powered by Google |
Google Inc., 20 West Kinzie, Chicago IL USA 60610 |
No comments:
Post a Comment