Click here to Skip to main content
12,701,854 members (35,777 online)
   

Database

 
AnswerRe: Can a SQL login have more than one user Pin
ManishaSCode15-Jul-12 4:34
memberManishaSCode15-Jul-12 4:34 
GeneralRe: Can a SQL login have more than one user Pin
Jan Steyn16-Jul-12 1:34
memberJan Steyn16-Jul-12 1:34 
AnswerRe: Can a SQL login have more than one user Pin
rimazuc17-Jul-12 1:07
memberrimazuc17-Jul-12 1:07 
QuestionSql query that sorts data by top quantity per category Pin
H123ardie13-Jul-12 17:49
memberH123ardie13-Jul-12 17:49 
GeneralRe: Sql query that sorts data by top quantity per category Pin
PIEBALDconsult13-Jul-12 20:00
memberPIEBALDconsult13-Jul-12 20:00 
AnswerRe: Sql query that sorts data by top quantity per category Pin
Tejas rao15-Jul-12 1:49
memberTejas rao15-Jul-12 1:49 
GeneralRe: Sql query that sorts data by top quantity per category Pin
H123ardie15-Jul-12 16:18
memberH123ardie15-Jul-12 16:18 
GeneralRe: Sql query that sorts data by top quantity per category Pin
Luc Pattyn15-Jul-12 17:27
mvpLuc Pattyn15-Jul-12 17:27 
This works fine for SQL Server:

SELECT Qty, t1.cat FROM Inv1 AS t1
INNER JOIN
(SELECT MAX(Qty) AS mq, cat FROM Inv1 GROUP BY cat) AS t2
ON t1.cat=t2.cat
ORDER BY mq DESC, Qty DESC


However, you didn't fully specify what you want: when two categories have equal maxima, what should happen? The above may intertwine such categories!

This wouldn't:
SELECT Qty, t1.cat FROM Inv1 AS t1
INNER JOIN
(SELECT MAX(Qty) AS mq, cat FROM Inv1 GROUP BY cat) AS t2
ON t1.cat=t2.cat
ORDER BY mq DESC, cat, Qty DESC


Smile | :)
Luc Pattyn [My Articles] Nil Volentibus Arduum

GeneralRe: Sql query that sorts data by top quantity per category Pin
H123ardie15-Jul-12 17:50
memberH123ardie15-Jul-12 17:50 
Questionmake a databse with ADO.Net Pin
messages13-Jul-12 5:50
membermessages13-Jul-12 5:50 
AnswerRe: make a databse with ADO.Net Pin
Sandeep Mewara15-Jul-12 1:15
mvpSandeep Mewara15-Jul-12 1:15 
Questionshould i Make new database after Financial year Pin
Member 782022011-Jul-12 21:57
memberMember 782022011-Jul-12 21:57 
AnswerRe: should i Make new database after Financial year Pin
Richard MacCutchan12-Jul-12 0:33
mvpRichard MacCutchan12-Jul-12 0:33 
AnswerRe: should i Make new database after Financial year Pin
Eddy Vluggen12-Jul-12 0:39
memberEddy Vluggen12-Jul-12 0:39 
AnswerRe: should i Make new database after Financial year Pin
PIEBALDconsult13-Jul-12 4:51
memberPIEBALDconsult13-Jul-12 4:51 
QuestionGenerate Excel From SQL Pin
vvashishta11-Jul-12 20:48
membervvashishta11-Jul-12 20:48 
AnswerRe: Generate Excel From SQL Pin
PIEBALDconsult11-Jul-12 20:54
memberPIEBALDconsult11-Jul-12 20:54 
QuestionRe: Generate Excel From SQL Pin
Eddy Vluggen12-Jul-12 0:43
memberEddy Vluggen12-Jul-12 0:43 
QuestionSQL CE license question... Pin
Jun Du11-Jul-12 17:41
memberJun Du11-Jul-12 17:41 
AnswerRe: SQL CE license question... Pin
Richard MacCutchan12-Jul-12 0:32
mvpRichard MacCutchan12-Jul-12 0:32 
AnswerRe: SQL CE license question... Pin
Eddy Vluggen12-Jul-12 0:33
memberEddy Vluggen12-Jul-12 0:33 
QuestionHELP SQL WILDCARDS PROB Pin
EjojAnrodac11-Jul-12 8:31
memberEjojAnrodac11-Jul-12 8:31 
AnswerRe: HELP SQL WILDCARDS PROB Pin
Luc Pattyn11-Jul-12 8:38
mvpLuc Pattyn11-Jul-12 8:38 
GeneralMessage Removed Pin
EjojAnrodac11-Jul-12 8:41
memberEjojAnrodac11-Jul-12 8:41 
AnswerRe: HELP SQL WILDCARDS PROB Pin
Luc Pattyn11-Jul-12 8:45
mvpLuc Pattyn11-Jul-12 8: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.


Advertise | Privacy | Mobile
Web02 | 2.8.170118.1 | Last Updated 24 Jan 2017
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid