Click here to Skip to main content
15,879,535 members
Home / Discussions / Database
   

Database

 
GeneralRe: Find who dropped a table or column or view Pin
Mycroft Holmes5-Nov-15 19:31
professionalMycroft Holmes5-Nov-15 19:31 
AnswerRe: Find who dropped a table or column or view Pin
Afzaal Ahmad Zeeshan8-Nov-15 1:04
professionalAfzaal Ahmad Zeeshan8-Nov-15 1:04 
QuestionWhat is the default isolation level of sqlserver 2008 R2 and 2005 Pin
MyJoiT3-Nov-15 2:15
MyJoiT3-Nov-15 2:15 
AnswerRe: What is the default isolation level of sqlserver 2008 R2 and 2005 Pin
Richard MacCutchan3-Nov-15 2:44
mveRichard MacCutchan3-Nov-15 2:44 
AnswerRe: What is the default isolation level of sqlserver 2008 R2 and 2005 Pin
Afzaal Ahmad Zeeshan3-Nov-15 3:56
professionalAfzaal Ahmad Zeeshan3-Nov-15 3:56 
QuestionSql Server DataBase Pin
Member 121090622-Nov-15 21:40
Member 121090622-Nov-15 21:40 
AnswerRe: Sql Server DataBase Pin
Chris Quinn3-Nov-15 0:32
Chris Quinn3-Nov-15 0:32 
AnswerRe: Sql Server DataBase Pin
RNA Team3-Nov-15 21:02
RNA Team3-Nov-15 21:02 
Try this

SQL
DECLARE @T TABLE(SName VARCHAR(20), Subject VARCHAR(20), Marks INT, ExamDate  DATE)
INSERT INTO @T
SELECT 'A', 'Subject1', 77, '2011-01-01' UNION ALL
SELECT 'A', 'Subject2', 97, '2011-01-01' UNION ALL
SELECT 'B', 'Subject1', 80 ,'2012-04-01' UNION ALL
SELECT 'B', 'Subject2', 70, '2012-03-01' UNION ALL
SELECT 'C', 'Subject1', 44, '2011-01-01' UNION ALL
SELECT 'C', 'Subject2', 90, '2011-01-01' UNION ALL
SELECT 'D', 'Subject1', 79 ,'2012-04-01' UNION ALL
SELECT 'D', 'Subject2', 66, '2012-03-01'

SELECT X.*
FROM ( SELECT
        t.*
        ,Rn = DENSE_RANK() OVER(PARTITION BY t.Subject ORDER BY t.Marks DESC)
FROM @T t) X WHERE X.Rn = 3


/*

SName	Subject	   Marks	ExamDate	Rn
A	     Subject1	77	    2011-01-01	3
B	     Subject2	70	    2012-03-01	3


*/

modified 13-Nov-15 6:52am.

GeneralRe: Sql Server DataBase Pin
Mycroft Holmes3-Nov-15 21:15
professionalMycroft Holmes3-Nov-15 21:15 
GeneralRe: Sql Server DataBase Pin
RNA Team3-Nov-15 21:50
RNA Team3-Nov-15 21:50 
GeneralRe: Sql Server DataBase Pin
Mycroft Holmes4-Nov-15 12:57
professionalMycroft Holmes4-Nov-15 12:57 
QuestionRows as column using Pivot but with multiple rows and Column Pin
indian14330-Oct-15 3:55
indian14330-Oct-15 3:55 
AnswerRe: Rows as column using Pivot but with multiple rows and Column Pin
Chris Quinn30-Oct-15 5:43
Chris Quinn30-Oct-15 5:43 
AnswerRe: Rows as column using Pivot but with multiple rows and Column Pin
indian14330-Oct-15 5:44
indian14330-Oct-15 5:44 
AnswerRe: Rows as column using Pivot but with multiple rows and Column Pin
RNA Team30-Oct-15 19:23
RNA Team30-Oct-15 19:23 
AnswerRe: Rows as column using Pivot but with multiple rows and Column Pin
sandeepmittal118-Nov-15 0:04
sandeepmittal118-Nov-15 0:04 
GeneralRe: Rows as column using Pivot but with multiple rows and Column Pin
Richard Deeming9-Nov-15 2:01
mveRichard Deeming9-Nov-15 2:01 
GeneralRe: Rows as column using Pivot but with multiple rows and Column Pin
sandeepmittal119-Nov-15 19:25
sandeepmittal119-Nov-15 19:25 
QuestionError in IF statement in MySQL Pin
Jassim Rahma29-Oct-15 4:31
Jassim Rahma29-Oct-15 4:31 
AnswerRe: Error in IF statement in MySQL Pin
Eddy Vluggen29-Oct-15 5:08
professionalEddy Vluggen29-Oct-15 5:08 
AnswerRe: Error in IF statement in MySQL Pin
Wombaticus29-Oct-15 5:45
Wombaticus29-Oct-15 5:45 
QuestionGet all Tables which have Duplicate values on Columns Name and Description Pin
indian14328-Oct-15 14:09
indian14328-Oct-15 14:09 
AnswerRe: Get all Tables which have Duplicate values on Columns Name and Description Pin
Jörgen Andersson28-Oct-15 22:31
professionalJörgen Andersson28-Oct-15 22:31 
GeneralRe: Get all Tables which have Duplicate values on Columns Name and Description Pin
indian14329-Oct-15 8:29
indian14329-Oct-15 8:29 
AnswerRe: Get all Tables which have Duplicate values on Columns Name and Description Pin
RNA Team30-Oct-15 20:13
RNA Team30-Oct-15 20:13 

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.