Click here to Skip to main content
15,898,939 members
Home / Discussions / Database
   

Database

 
AnswerRe: Inserting Master and DEtail Tables Pin
Mycroft Holmes1-Jun-13 2:35
professionalMycroft Holmes1-Jun-13 2:35 
GeneralRe: Inserting Master and DEtail Tables Pin
indian1431-Jun-13 17:38
indian1431-Jun-13 17:38 
GeneralRe: Inserting Master and DEtail Tables Pin
Mycroft Holmes1-Jun-13 17:59
professionalMycroft Holmes1-Jun-13 17:59 
GeneralRe: Inserting Master and DEtail Tables Pin
indian1432-Jun-13 12:18
indian1432-Jun-13 12:18 
GeneralRe: Inserting Master and DEtail Tables Pin
Mycroft Holmes2-Jun-13 12:35
professionalMycroft Holmes2-Jun-13 12:35 
GeneralRe: Inserting Master and DEtail Tables Pin
indian1432-Jun-13 13:54
indian1432-Jun-13 13:54 
GeneralRe: Inserting Master and DEtail Tables Pin
Mycroft Holmes2-Jun-13 14:29
professionalMycroft Holmes2-Jun-13 14:29 
GeneralRe: Inserting Master and DEtail Tables Pin
indian1432-Jun-13 19:15
indian1432-Jun-13 19:15 
GeneralRe: Inserting Master and DEtail Tables Pin
Mycroft Holmes2-Jun-13 20:02
professionalMycroft Holmes2-Jun-13 20:02 
GeneralRe: Inserting Master and DEtail Tables Pin
indian1433-Jun-13 7:12
indian1433-Jun-13 7:12 
GeneralRe: Inserting Master and DEtail Tables Pin
indian14311-Jun-13 7:59
indian14311-Jun-13 7:59 
GeneralRe: Inserting Master and DEtail Tables Pin
Ralph D. Wilson II10-Jul-13 9:42
Ralph D. Wilson II10-Jul-13 9:42 
Questionquery error Pin
Bhairava Prasad30-May-13 2:03
Bhairava Prasad30-May-13 2:03 
AnswerRe: query error Pin
Anurag Sinha V30-May-13 2:25
Anurag Sinha V30-May-13 2:25 
AnswerRe: query error Pin
Mycroft Holmes30-May-13 12:03
professionalMycroft Holmes30-May-13 12:03 
AnswerRe: query error Pin
Azarudhin4-Jun-13 3:41
professionalAzarudhin4-Jun-13 3:41 
QuestionMultiple Join to the same field Pin
Jassim Rahma29-May-13 4:31
Jassim Rahma29-May-13 4:31 
AnswerRe: Multiple Join to the same field Pin
David Mujica29-May-13 4:56
David Mujica29-May-13 4:56 
AnswerRe: Multiple Join to the same field Pin
Mycroft Holmes29-May-13 12:49
professionalMycroft Holmes29-May-13 12:49 
QuestionSelect top 2 not working on Maximum Record using SQL Pin
SE Ubaid29-May-13 2:38
SE Ubaid29-May-13 2:38 
Issue occrue on select top 2 like this
when run the following query then show the following result

SELECT u.ElectionDtlID,u.PartyShortNameEng,u.ConstituencyName,u.VotesObtained
FROM tblElectionsDetail u where u.ConstituencyName='NA 108' and u.electionyear='2013'
and u.VotesObtained > 0

RESULT:
ID NameEng Constituency VotesObtained
10864 PPPP NA 108 29883
10865 PMLN NA 108 73789
10866 PTI NA 108 25406
10867 JI NA 108 18270
10868 Ind NA 108 85009

But now i want to get only top result of Maximum VotesObtained Candidate
like this :
Query:

select top 2 VotesObtained from tblElectionsDetail where ConstituencyName='NA 108';
and electionyear='2013'; order by VotesObtained desc

Then this issue the following Result
OutPut Table:
VotesObtained
85009
73789

this is working good and also result show correct but when i want to show max/top 2 recrod but order by asc then it's working correct like this

Query:

select top 2 VotesObtained from tblElectionsDetail where ConstituencyName='na 108'
and electionyear='2013' order by VotesObtained asc

the result of the query like this
OutPut Table:
VotesObtained
0
0

so i wan to get the result like this.

VotesObtained
73789
85009

any body can help me ?

-- modified 29-May-13 8:47am.
AnswerRe: Select top 2 not working on Maximum Record using SQL Pin
Eddy Vluggen29-May-13 3:17
professionalEddy Vluggen29-May-13 3:17 
AnswerRe: Select top 2 not working on Maximum Record using SQL Pin
Arman S.29-May-13 9:44
Arman S.29-May-13 9:44 
Questiondecryption Pin
Member 870181328-May-13 6:42
Member 870181328-May-13 6:42 
AnswerRe: decryption Pin
R. Giskard Reventlov28-May-13 7:43
R. Giskard Reventlov28-May-13 7:43 
QuestionRe: decryption Pin
Eddy Vluggen28-May-13 9:45
professionalEddy Vluggen28-May-13 9:45 

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.