| Author |
Topic |
|
dhinasql
Posting Yak Master
195 Posts |
Posted - 2009-03-09 : 05:20:24
|
| Dear Friends,I need your help in modifying query,Please find the below querySELECT r.ID, r.Title,r.Text,r.Description,r.picture as picture,r.EntryName,r.UserName,r.firstname FROM (SELECT ROW_NUMBER() OVER (ORDER BY ID DESC) AS Seq2,t.ID, t.Title,t.Text,t.Description,t.picture as picture,t.EntryName,t.UserName,t.firstname FROM (Select ROW_NUMBER() OVER(PARTITION BY con.UserName ORDER BY c.ID DESC) AS Seq1, c.ID, c.Title,c.Text,c.Description,u.picture as picture,c.EntryName,con.UserName,u.firstname,userid from dbo.wlbuserfls u inner join subtext_Config con on u.username = con.UserName inner join subtext_Content as c on con.BlogId = c.BlogId where u.picture !='images/defaultphoto.gif') t WHERE t.Seq1=1 )r WHERE Seq2<=5Now it is displaying the ID Title Text Description picture EntryName UserNamefirstnameI want to fetch userid and display with this fields , userid is available in wlbuserflsPlease modify the query, thanks in advance |
|
|
matty
Posting Yak Master
161 Posts |
Posted - 2009-03-09 : 05:38:48
|
| SELECT r.ID, r.Title,r.Text,r.Description,r.picture as picture,r.EntryName,r.UserName,r.firstname,r.useridFROM ( SELECT ROW_NUMBER() OVER (ORDER BY ID DESC) AS Seq2,t.ID, t.Title,t.Text,t.Description,t.picture as picture, t.EntryName,t.UserName,t.firstname,t.userid FROM ( Select ROW_NUMBER() OVER(PARTITION BY con.UserName ORDER BY c.ID DESC) AS Seq1, c.ID, c.Title,c.Text, c.Description,u.picture as picture,c.EntryName,con.UserName,u.firstname,userid from dbo.wlbuserfls u inner join subtext_Config con on u.username = con.UserName inner join subtext_Content as c on con.BlogId = c.BlogId where u.picture !='images/defaultphoto.gif' ) t WHERE t.Seq1=1 )r WHERE Seq2<=5 |
 |
|
|
|
|
|