Click here to Skip to main content
12,818,691 members (28,263 online)
   

Database

 
AnswerRe: How to convert Physical XML files into Sqlserver Tables? Pin
PIEBALDconsult10-Aug-12 14:32
memberPIEBALDconsult10-Aug-12 14:32 
AnswerRe: How to convert Physical XML files into Sqlserver Tables? Pin
Eddy Vluggen11-Aug-12 0:52
memberEddy Vluggen11-Aug-12 0:52 
QuestionHow do you use the AVG api in sql to manage grouped output? Pin
Xarzu10-Aug-12 14:04
memberXarzu10-Aug-12 14:04 
AnswerRe: How do you use the AVG api in sql to manage grouped output? Pin
Paul Conrad10-Aug-12 21:18
memberPaul Conrad10-Aug-12 21:18 
GeneralRe: How do you use the AVG api in sql to manage grouped output? Pin
Xarzu11-Aug-12 14:30
memberXarzu11-Aug-12 14:30 
AnswerRe: How do you use the AVG api in sql to manage grouped output? Pin
Paul Conrad11-Aug-12 14:32
memberPaul Conrad11-Aug-12 14:32 
AnswerRe: How do you use the AVG api in sql to manage grouped output? Pin
Eddy Vluggen10-Aug-12 23:17
memberEddy Vluggen10-Aug-12 23:17 
AnswerRe: How do you use the AVG api in sql to manage grouped output? Pin
Niladri_Biswas21-Aug-12 23:51
mvpNiladri_Biswas21-Aug-12 23:51 
All Version of Sql server

Select City, AVG(Salary) AS Salary
FROM @t
Group By City
Order By City DESC


This can also be done by treating AVG function as Analytical function which is available since SQL Server 2005

Select City,Salary From
(
    Select
        Rn = Row_Number() Over(PARTITION BY City Order By (Select 1))
        ,City
        ,AVG(Salary) OVER(PARTITION BY City) AS Salary
    From @t) X
Where X.Rn = 1
Order By City DESC


The answer for both the cases

City Salary
Seattle 20000
Redmond 30000
Niladri Biswas
(Code Project MVP 2012)

QuestionHow to store a standard selection? Pin
Jörgen Andersson10-Aug-12 10:57
memberJörgen Andersson10-Aug-12 10:57 
AnswerRe: How to store a standard selection? Pin
mark merrens10-Aug-12 11:02
membermark merrens10-Aug-12 11:02 
GeneralRe: How to store a standard selection? Pin
Jörgen Andersson10-Aug-12 11:09
memberJörgen Andersson10-Aug-12 11:09 
GeneralRe: How to store a standard selection? Pin
mark merrens10-Aug-12 11:41
membermark merrens10-Aug-12 11:41 
AnswerRe: How to store a standard selection? Pin
Eddy Vluggen10-Aug-12 11:11
memberEddy Vluggen10-Aug-12 11:11 
GeneralRe: How to store a standard selection? Pin
Jörgen Andersson10-Aug-12 11:31
memberJörgen Andersson10-Aug-12 11:31 
QuestionDatabase status check and report Pin
leketekoa10-Aug-12 5:12
memberleketekoa10-Aug-12 5:12 
AnswerRe: Database status check and report Pin
David Mujica10-Aug-12 6:10
memberDavid Mujica10-Aug-12 6:10 
GeneralRe: Database status check and report Pin
leketekoa13-Aug-12 5:30
memberleketekoa13-Aug-12 5:30 
AnswerRe: Database status check and report Pin
jschell10-Aug-12 13:46
memberjschell10-Aug-12 13:46 
QuestionSymantec Q&A File Conversion Pin
snowman539-Aug-12 13:54
membersnowman539-Aug-12 13:54 
AnswerRe: Symantec Q&A File Conversion Pin
Eddy Vluggen9-Aug-12 23:21
memberEddy Vluggen9-Aug-12 23:21 
GeneralRe: Symantec Q&A File Conversion Pin
snowman5310-Aug-12 12:51
membersnowman5310-Aug-12 12:51 
GeneralRe: Symantec Q&A File Conversion Pin
Eddy Vluggen10-Aug-12 23:13
memberEddy Vluggen10-Aug-12 23:13 
AnswerRe: Symantec Q&A File Conversion Pin
Mycroft Holmes12-Aug-12 19:18
memberMycroft Holmes12-Aug-12 19:18 
GeneralRe: Symantec Q&A File Conversion Pin
snowman5313-Aug-12 7:36
membersnowman5313-Aug-12 7:36 
QuestionUsername/password protected database Pin
Kujtim Hyseni7-Aug-12 11:10
memberKujtim Hyseni7-Aug-12 11:10 

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
Web01 | 2.8.170308.1 | Last Updated 24 Mar 2017
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid