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 |
|
monaya
Yak Posting Veteran
58 Posts |
Posted - 2010-03-07 : 10:50:39
|
How do I sort query by most recent pages but only return the book titles, without booktitle duplicates if you havebookid booktitle1 x2 f3 gpageid bookid 1 12 13 14 25 26 3 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2010-03-07 : 10:59:12
|
| [code]select bookid,booktitle,pageidfrom(select row_number() over (partition by b.bookid order pageid desc) as seq,b.bookid,b.booktitle,p.pageidfrom books bjoin pages pon p.bookid = b.bookid)twhere seq=1[/code]------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
|
|
|
|