Click here to Skip to main content
15,911,142 members
Home / Discussions / ASP.NET
   

ASP.NET

 
Questiononly get one last record with the same field value during sorting database records Pin
Farhad Eft5-Apr-11 7:46
Farhad Eft5-Apr-11 7:46 
AnswerRe: only get one last record with the same field value during sorting database records Pin
Wendelius5-Apr-11 8:34
mentorWendelius5-Apr-11 8:34 
You can do this (at least partially) in the db. For example:
SQL
SELECT ...
       SUBSTRING(m.Message,1, 80) AS PartialMessage,
       ...
FROM Messages m
WHERE m.MessageID IN (SELECT MAX(m2.MessageId)
                      FROM Messages m2
                      GROUP BY m2.SenderId)

The above (with typos corrected etcSmile | :) ) should fetch the latest messsages for each sender and bring only first 80 characters of the message.

In the example I'm relying on a fact that the MessageId field is constantly growing number so it will order the messages correctly. If this is not true then you would have to use the date field to get the latest messages.
The need to optimize rises from a bad design.My articles[^]

AnswerRe: only get one last record with the same field value during sorting database records Pin
Viral Upadhyay5-Apr-11 8:35
Viral Upadhyay5-Apr-11 8:35 
QuestionProblem with DropDownList and RequiredFieldValidator Pin
kbalias5-Apr-11 3:10
kbalias5-Apr-11 3:10 
AnswerRe: Problem with DropDownList and RequiredFieldValidator Pin
Not Active5-Apr-11 7:00
mentorNot Active5-Apr-11 7:00 
AnswerRe: Problem with DropDownList and RequiredFieldValidator Pin
Parwej Ahamad5-Apr-11 8:47
professionalParwej Ahamad5-Apr-11 8:47 
AnswerRe: Problem with DropDownList and RequiredFieldValidator Pin
Prasanta_Prince14-Apr-11 0:59
Prasanta_Prince14-Apr-11 0:59 
GeneralRe: Problem with DropDownList and RequiredFieldValidator Pin
kbalias27-Apr-11 21:06
kbalias27-Apr-11 21:06 
GeneralRe: Problem with DropDownList and RequiredFieldValidator Pin
Prasanta_Prince28-Apr-11 3:42
Prasanta_Prince28-Apr-11 3:42 
QuestionPaypal Tax Pin
Ramkumar_S5-Apr-11 2:28
Ramkumar_S5-Apr-11 2:28 
QuestionNeed help in implementing new skin for AuctionWorx Pin
NetMan20125-Apr-11 1:50
NetMan20125-Apr-11 1:50 
AnswerRe: Need help in implementing new skin for AuctionWorx Pin
Pete O'Hanlon5-Apr-11 2:33
mvePete O'Hanlon5-Apr-11 2:33 
QuestionAspx Login and Sql Server Problem - Help Me :( Pin
De_Novice4-Apr-11 10:01
De_Novice4-Apr-11 10:01 
AnswerRe: Aspx Login and Sql Server Problem - Help Me :( Pin
Wendelius4-Apr-11 10:15
mentorWendelius4-Apr-11 10:15 
AnswerRe: Aspx Login and Sql Server Problem - Help Me :( Pin
SamRST4-Apr-11 21:08
SamRST4-Apr-11 21:08 
QuestionPaypal testing.. Pin
Ramkumar_S4-Apr-11 1:09
Ramkumar_S4-Apr-11 1:09 
QuestionWhy this code does not run correctly on Linux server Pin
Abbas Fatshidi4-Apr-11 0:32
professionalAbbas Fatshidi4-Apr-11 0:32 
AnswerRe: Why this code does not run correctly on Linux server Pin
CodyDaemon4-Apr-11 1:39
CodyDaemon4-Apr-11 1:39 
QuestionHow can i copy html code to clipboard by using javascript? Pin
buffering833-Apr-11 20:10
buffering833-Apr-11 20:10 
AnswerRe: How can i copy html code to clipboard by using javascript? Pin
Ankur\m/3-Apr-11 21:14
professionalAnkur\m/3-Apr-11 21:14 
GeneralRe: How can i copy html code to clipboard by using javascript? Pin
buffering833-Apr-11 22:37
buffering833-Apr-11 22:37 
Questionproblem with the web chat application Pin
Danda903-Apr-11 11:31
Danda903-Apr-11 11:31 
AnswerRe: problem with the web chat application Pin
Parwej Ahamad3-Apr-11 19:37
professionalParwej Ahamad3-Apr-11 19:37 
Questionautomation (like on whatismyip.com) Pin
Mark H Bishop3-Apr-11 11:24
Mark H Bishop3-Apr-11 11:24 
AnswerRe: automation (like on whatismyip.com) Pin
Not Active3-Apr-11 12:31
mentorNot Active3-Apr-11 12:31 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.