| Author |
Topic |
|
pelegk2
Aged Yak Warrior
723 Posts |
Posted - 2009-05-26 : 02:46:36
|
| i have a table like this:user,target,uniqueid,datetime,phonethe data look like this :a,x1,w3e23e,20090501125124,4521424a,x1,w3e23e,20090501125124,4521424a,x2,w3ezzz,20090501125124,4521424a,x2,w3ezzz,20090501125124,4521424a,x2,w3ezzz,20090501125124,4521424and i want to countfor each "user+target",how many times rows return on themself one time,two times or three times.for exampme :user a with target x1 appears twiceuser a with target x2 appears three times.Thnaks in advacepelegIsrael -the best place to live in aftr heaven 9but no one wan't to go there so fast -:) |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2009-05-26 : 02:48:33
|
[code]select user, target, count(*)from tableagroup by user, target[/code] KH[spoiler]Time is always against us[/spoiler] |
 |
|
|
bklr
Master Smack Fu Yak Hacker
1693 Posts |
Posted - 2009-05-26 : 02:49:28
|
| select distinct user,target, count(*) from tablename group by user,target |
 |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2009-05-26 : 02:57:31
|
quote: Originally posted by bklr select distinct user,target, count(*) from tablename group by user,target
Why distinct there ? KH[spoiler]Time is always against us[/spoiler] |
 |
|
|
|
|
|