Click here to Skip to main content
12,295,791 members (34,740 online)
Rate this:
 
Please Sign up or sign in to vote.
Hi,

I have a table with columns are ID,USR_ID,MachineName,MachineIP,StartTime,EndTime,TimeLastSeenConnected,SystemLogout,LoggedFrom

in this table duplicates id's are there.

i wrote a query to get duplicate rows.

select ID ,COUNT(ID) from tblecsession
group by ID
having (COUNT(*) > 1)


Result:

032nec45vgdxbg45n0k12v45    2
0cqisn551oongjuxv1oapo45    2
0f2qcq45n1c1xr5554ef4sn1    2
0kf1xmz1x54fpb453ywii455    2
0tunqy55lmrvbsfyqj2oqavf    2
1s0p3jfrugdhllrg10xdc055    3
1t3f3x45xx4x5dqcv4tjxi45    2
1wtslhi5ubvazv45kslctiq1    2
201wg4usv2vberftbzepy02s    2
22limrqd2i3yhaiuwsigpm55    2
2c1duhymwhfa0dnauhhfmfas    2
2ov5fl55cg5n2j55in4ygq55    2
3bkwnr55qo3fcjjlqrmliofo    2
3y2hn5v0jz3dol55a1q5r5m0    2
4brgztiu4q5l3i45cql4r145    2
4dpq0v45b4vrtb45a0awfb45    2
4dsv5t555nqjpv55yjmoi045    2
4vsug255uilni4rql3yqim55    2
4yaoo2isb3gccw45bmlsdz45    2
505wuj55dohfh0iwaolbbqv5    3
53xggw45zkupo1ayjdacg245    3
5bsuzzewiw0liw2rxyg1qzus    2
5laudl23umwkap45t32xce45    2
5m2szzny1cjydu55p1oqvy45    2
5oui5c4514puwj55myaboy55    2
a14j2b45ogkw1fq254kvzg55    2
ai5eytnfhbr25lekqsas2x55    2
app5kg45znie3445ikgt4vvr    2
arn3s155ped11lzokb0w0amk    2
arwgtlfoe44ncxf0yqbqzibq    2
bflkve55lz0ebritfbf3we55    2
bgmwmomwxdcpr055ku0yu0jl    3
bjmic0nqxcc5mr550kxw5x45    2
bt4rda450b2pw2meeanh4e2q    2
bzqqeo45et40trq4pc2qmna1    2
c40s5qu2xa0nd0j2gboogsqf    2
cc4x0r55oew4zx55kvcqgz45    2
cw4drr55hyss1r45nwfwwwix    2
db52lv45c1tvob55sgndja3u    5
ddxgal45q1josjqzxtpxy055    2
dj3vts45d5as0r45chns1145    2
dpxvcg5504m53unajwrrmbfr    2
dttkca45csqj5j55fucas1ns    2
e2dhsb45fo1y4m45b2xwme55    2
ebkk1o45trt0cwugo2rpvtvi    2
epv3idbs4hqvfpzazdfibuul    2
euqurk2z0erlbp45xbl2vxbq    3
ffrjlb45dpua0wuxq0poa5rc    2
fjzjlqatfe2mdczeww5x4055    2
fyq2hkrwxfwgre555kvxk3u4    2
gbsgw2eanuczk345tt3lj045    2
gnhife552q5iyqra0owcyvri    2
grfc4n45o3l5stnalq0w5xro    2
ha1muhaj0e3pv2qurn153r45    4
hesd2t550erkxtqcvxq33t55    2
hjwsb5eoruohb445sbc4ig45    2
hoydog45fg1cqky5fp3l4v55    2
hsabxc55nfhifdaofugc3e55    2
i02z5b45r3pnanjysk1cgwan    2
imzmkn55oh1ju0u0slnpxdif    2
ipbbr131nolpbge1i3e2skyd    2
ixtrrq55ml3e4045f4fju2rr    2
jehvxnufygikrqmo4wh1io55    5
k33maf55sysrrxqjj3wsyrby    2
kolwswywgaip3l55zmrzg445    4
l30w2145v4ft1zfshzptqkml    2
lagtho55pjrl3245z5fm4peb    2
laiotq2emgrrqy4543n425mk    2
ldmhq2rezldyo0qbqj5ulbbl    2
lebyeb555ofcfmm3pvmg3o55    2
lfpwrx45mg2l3h55abh2krmm    2
ll0ugev4fsxdwwegb3xtupb1    2
lrgru255euj3xfylymfp3gev    2
lzmyesbrmxhr0d45m4rywlnz    2
mgwy50qhrg1ey5i44aijcfii    2
mjczgy553jwxyd45sjqpa1aa    2
mjp01i55kbf5ppao0tzsoh55    2
mptruq45ecwnon45zrrrmb55    2
mwjs052pbsskwffgijdnzhrb    2
nbywes452jnfd3aqzfjpxr45    3
netreg55bpqj4dzlqz5rv445    2
nywshfusilsrhc45ziyqxszd    2
oscwx3j2solc24y1wd3s1peu    2
p3dsol45cnd4y045y1fswa55    2
p4tcps3imqtrmhn5lxmxuc45    2
pbqheqvberjesq3icqojneum    2
pq5uiwzj4zktrp45ha3v0455    2
pssnin45eqjv3s55gwebns55    2
qe4r0f4550sgc045io3ap1u5    2
qlxgxhmzqnbrdkizci33np55    2
rfbn3xmqcypjbv205j3ya2jb    3
rwxehq55nthm5e45rjp5wq55    2
sa34lofe1sskvrrz1nzx5b55    2
sgvwl2rzjzyfcvmsx4fhugmo    2
shksxi55wtlxeg45bprcqd55    2
sxmt3q45wkeun0554i1fs5jd    2
tutatsiw43hcs2yivm2knqa3    2
ur345555kcxjug453ev5og55    2
utqsch552w5svw55tfqiwp55    2
v2iiegekdbv5cr55jdslixrm    2
vlol2oibhrj0j545m1p5jmfa    3
vmr1et45ywmuf2ym2plehj55    2
vy55qu45ijbywa551cmlcl45    2
wkiktw453xnxz5ybew3bdwmd    2
woq1wffdkiq3rlz13xnt222a    2
x4xlkm55kki5o2qdpzqeva45    2
xbqegbequkzocmqjlqq1yfrz    2
zskf4x45hm0hb1vdacpins45    2


but i want dulpicates id's along with all columns

how to write query ?

is it possible to get?
Posted 6-Aug-12 23:54pm

1 solution

Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 1

Select * from tblecsession where Id in 
 
(select ID from tblecsession
group by ID
having (COUNT(*) > 1))
  Permalink  
Comments
Member 7932936 7-Aug-12 6:07am
   
Thank you very much.it working fine
Santhosh Kumar J 7-Aug-12 6:10am
   
Welcome

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

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy | Mobile
Web02 | 2.8.160525.2 | Last Updated 7 Aug 2012
Copyright © CodeProject, 1999-2016
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100