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 |
|
pazzy11
Posting Yak Master
145 Posts |
Posted - 2007-11-28 : 10:34:56
|
| Hi I have this [CODE]select emailid,count(emailid) as 'No.of occurences',FROM tableA where start_moment between '2007-11-01' and '2007-11-02'GROUP BY emailidhaving (COUNT(emailid) > 1)[/CODE]Fair enough this returns the emailid along with the amount of times it appears (all greater then 1 .. duplicated in other words)My question is , there is also a start_moment field in tableAso i need to get the max or min start_moment along with the above result? |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2007-11-28 : 10:58:23
|
just add min(start_moment), max(start_moment) to the select lists KH[spoiler]Time is always against us[/spoiler] |
 |
|
|
pazzy11
Posting Yak Master
145 Posts |
Posted - 2007-11-28 : 11:16:17
|
| When I do that, and GROUP BY start_moment as well it returns 0 results, which is impossible ..as the original has results |
 |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2007-11-28 : 11:19:36
|
don't group by start_moment, just GROUP BY emailid KH[spoiler]Time is always against us[/spoiler] |
 |
|
|
|
|
|