Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
pradeep_iete
Yak Posting Veteran
84 Posts |
Posted - 2008-06-23 : 11:06:35
|
| I want to remove duplication entries on the basis of compaparingApID,StID,CreationDate.If three match only i shoul get result set for deletionID ApID StID RoleID CreationDate40 100 5 2 2008-01-31 20:27:03.85041 101 5 2 2008-01-31 20:27:03.85042 101 5 2 2008-01-31 20:27:03.850901 1011 81 2 2008-01-31 20:27:03.850902 1011 81 2 2008-01-31 20:27:03.850903 1012 74 2 2008-01-31 20:27:03.8503025 1013 4 2 2008-02-22 11:43:39.153904 1014 74 2 2008-01-31 20:27:03.8503002 1016 4 2 2008-02-22 11:28:34.5133170 1017 94 2 2008-02-22 12:35:17.450906 1019 4 2 2008-01-31 20:27:03.85043 102 5 2 2008-01-31 20:27:03.850907 1020 81 2 2008-01-31 20:27:03.850908 1021 74 2 2008-01-31 20:27:03.8503194 1022 74 2 2008-02-22 12:43:46.030909 1023 81 2 2008-01-31 20:27:03.8504750 1024 81 2 2008-05-23 14:27:45.317912 1027 81 2 2008-01-31 20:27:03.8504751 1028 81 2 2008-05-23 14:27:45.3172638 103 5 2 2008-02-21 16:26:19.8772571 103 150 128 2008-02-19 14:23:57.6103205 1031 4 2 2008-02-22 12:47:32.653915 1032 74 2 2008-01-31 20:27:03.8503103 1039 81 2 2008-02-22 12:08:32.0432639 104 5 2 2008-02-21 16:26:19.877918 1040 74 2 2008-01-31 20:27:03.850919 1041 4 2 2008-01-31 20:27:03.8503206 1042 4 2 2008-02-22 12:47:50.903920 1043 94 2 2008-01-31 20:27:03.850922 1045 4 2 2008-01-31 20:27:03.8503208 1046 4 2 2008-02-22 12:48:11.857924 1048 4 2 2008-01-31 20:27:03.8503209 1049 4 2 2008-02-22 12:48:30.6872640 105 5 2 2008-02-21 16:26:19.877926 1050 74 2 2008-01-31 20:27:03.8503156 1051 5 2 2008-02-22 12:27:06.700927 1052 94 2 2008-01-31 20:27:03.850928 1053 74 2 2008-01-31 20:27:03.8503098 1054 81 2 2008-02-22 12:07:00.0003044 1055 5 2 2008-02-22 11:50:26.373929 1056 4 2 2008-01-31 20:27:03.850930 1058 81 2 2008-01-31 20:27:03.850931 1059 94 2 2008-01-31 20:27:03.85044 106 5 2 2008-01-31 20:27:03.8503161 1060 4 2 2008-02-22 12:29:31.687933 1061 74 2 2008-01-31 20:27:03.850934 1062 94 2 2008-01-31 20:27:03.8503174 1063 74 2 2008-02-22 12:36:24.170935 1064 4 2 2008-01-31 20:27:03.850936 1064 4 2 2008-01-31 20:27:03.850938 1067 94 2 2008-01-31 20:27:03.850939 1068 94 2 2008-01-31 20:27:03.8503110 1069 4 2 2008-02-22 12:10:33.467940 1070 74 2 2008-01-31 20:27:03.850941 1070 74 2 2008-01-31 20:27:03.850942 1070 74 2 2008-01-31 20:27:03.850943 1070 74 2 2008-01-31 20:27:03.8503219 1071 74 2 2008-02-22 12:51:09.687944 1072 94 2 2008-01-31 20:27:03.850945 1073 4 2 2008-01-31 20:27:03.8503221 1074 81 2 2008-02-22 12:51:53.5603222 1075 4 2 2008-02-22 12:52:18.373946 1076 81 2 2008-01-31 20:27:03.850947 1077 4 2 2008-01-31 20:27:03.8503223 1078 4 2 2008-02-22 12:52:41.717948 1079 94 2 2008-01-31 20:27:03.8503220 1080 94 2 2008-02-22 12:51:30.467 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-06-23 : 11:09:35
|
| [code]DELETE tFROM (SELECT ROW_NUMBER() OVER(ApID,StID,CreationDate ORDER BY CreationDate) AS RowNo,*FROM YourTable)tWHERE t.RowNo >1[/code] |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2008-06-23 : 13:18:06
|
quote: Originally posted by visakh16
DELETE tFROM (SELECT ROW_NUMBER() OVER(Partition by ApID,StID,CreationDate ORDER BY CreationDate) AS RowNo,*FROM YourTable)tWHERE t.RowNo >1
MadhivananFailing to plan is Planning to fail |
 |
|
|
|
|
|