Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.databases.ms-sqlserver > #1459
| X-Received | by 10.224.10.6 with SMTP id n6mr43147833qan.4.1367342024843; Tue, 30 Apr 2013 10:13:44 -0700 (PDT) |
|---|---|
| X-Received | by 10.50.67.111 with SMTP id m15mr981472igt.12.1367342024624; Tue, 30 Apr 2013 10:13:44 -0700 (PDT) |
| Path | csiph.com!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!npeer01.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!s14no1301553qam.0!news-out.google.com!ef9ni37315qab.0!nntp.google.com!s14no1301542qam.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail |
| Newsgroups | comp.databases.ms-sqlserver |
| Date | Tue, 30 Apr 2013 10:13:44 -0700 (PDT) |
| In-Reply-To | <6957ef41-d7dc-492d-9ad2-e5a21b963965@googlegroups.com> |
| Complaints-To | groups-abuse@google.com |
| Injection-Info | glegroupsg2000goo.googlegroups.com; posting-host=216.14.58.122; posting-account=PG2dbQkAAADVILsQ0GhgAM6hZK18SIjs |
| NNTP-Posting-Host | 216.14.58.122 |
| References | <c2fb326a-1dee-4d93-b41e-16e00868c506@googlegroups.com> <6957ef41-d7dc-492d-9ad2-e5a21b963965@googlegroups.com> |
| User-Agent | G2/1.0 |
| MIME-Version | 1.0 |
| Message-ID | <0cb9b73a-25c2-4332-ad7b-9e9c090355ab@googlegroups.com> (permalink) |
| Subject | Re: need help with ordering groups of records |
| From | migurus <migurus@yahoo.com> |
| Injection-Date | Tue, 30 Apr 2013 17:13:44 +0000 |
| Content-Type | text/plain; charset=UTF-8 |
| Content-Transfer-Encoding | quoted-printable |
| X-Received-Bytes | 2207 |
| Xref | csiph.com comp.databases.ms-sqlserver:1459 |
Show key headers only | View raw
On Tuesday, April 23, 2013 5:19:15 AM UTC-7, Gints Plivna wrote: > ceturtdiena, 2013. gada 18. aprīlis 04:21:02 UTC+3, migurus rakstīja: > > > I have a list of customers and addresses they have visited, each record has a count of visits. I need to re-sort the list in such a way that customers with higher counts will be higher on the list, but all his/her records should stay together > > > > > [skipped] > > > > > > As you see, Juan Silva has 225 visits, which is highest of them all, so all his records are sorted before everybody else. The order of records within group belonging to the same customer is not important. > > > > > > > > > > > > Any hint or idea would be appreciated. > > > > > > select * from @t t > > order by MAX(cnt) OVER (PARTITION BY NAME) desc, cnt desc > > > > Gints Plivna > > http://www.gplivna.eu Thank you it works
Back to comp.databases.ms-sqlserver | Previous | Next — Previous in thread | Next in thread | Find similar
need help with ordering groups of records migurus <migurus@yahoo.com> - 2013-04-17 18:21 -0700
Re: need help with ordering groups of records rja.carnegie@gmail.com - 2013-04-17 19:56 -0700
Re: need help with ordering groups of records migurus <migurus@yahoo.com> - 2013-04-30 10:14 -0700
Re: need help with ordering groups of records Gints Plivna <gints.plivna@gmail.com> - 2013-04-23 05:19 -0700
Re: need help with ordering groups of records migurus <migurus@yahoo.com> - 2013-04-30 10:13 -0700
Re: need help with ordering groups of records rja.carnegie@gmail.com - 2013-04-30 11:37 -0700
csiph-web