Click here to Skip to main content
15,917,060 members
Home / Discussions / Database
   

Database

 
AnswerRe: Find tables used in stored procedures Pin
Eddy Vluggen5-Jan-10 7:34
professionalEddy Vluggen5-Jan-10 7:34 
GeneralRe: Find tables used in stored procedures Pin
Corporal Agarn5-Jan-10 8:09
professionalCorporal Agarn5-Jan-10 8:09 
GeneralRe: Find tables used in stored procedures Pin
Eddy Vluggen5-Jan-10 9:21
professionalEddy Vluggen5-Jan-10 9:21 
GeneralRe: Find tables used in stored procedures Pin
Corporal Agarn5-Jan-10 9:38
professionalCorporal Agarn5-Jan-10 9:38 
QuestionOracle 10g server is not starting on system startup Pin
A k ch4-Jan-10 23:11
A k ch4-Jan-10 23:11 
AnswerRe: Oracle 10g server is not starting on system startup Pin
Eddy Vluggen5-Jan-10 7:37
professionalEddy Vluggen5-Jan-10 7:37 
QuestionGROUP BY Clause... Pin
Illegal Operation4-Jan-10 15:28
Illegal Operation4-Jan-10 15:28 
AnswerRe: GROUP BY Clause... Pin
Niladri_Biswas4-Jan-10 15:56
Niladri_Biswas4-Jan-10 15:56 
Try this

Sample Data

declare @t table(dt date, tm int)
insert into @t 
	select '2010-01-05',15 union all 
	select '2010-01-05',16 union all 
	select '2010-01-05',18 union all 
	select '2010-01-05',36 union all 
	select '2010-01-05',59 union all 
	select '2010-01-06',01 union all 
	select '2010-01-06',20 union all 
	select '2010-01-07',30 union all 
	select '2009-12-21',34 union all 
	select '2009-12-22',12


Query

select dt,CntMins  = COUNT(tm),TotalMins = SUM(tm) from @t
group by dt
--order by SUM(tm) desc --[Incase you want to see the result in Descending Order]


Output
dt	CntMins	TotalMins
2009-12-21	1	34
2009-12-22	1	12
2010-01-05	5	144
2010-01-06	2	21
2010-01-07	1	30

Smile | :)

Niladri Biswas

AnswerRe: GROUP BY Clause... [modified] Pin
Mycroft Holmes4-Jan-10 19:07
professionalMycroft Holmes4-Jan-10 19:07 
GeneralRe: GROUP BY Clause... Pin
J4amieC4-Jan-10 21:52
J4amieC4-Jan-10 21:52 
GeneralRe: GROUP BY Clause... Pin
Mycroft Holmes4-Jan-10 22:42
professionalMycroft Holmes4-Jan-10 22:42 
QuestionGeneral Performance Question Pin
#realJSOP4-Jan-10 11:22
professional#realJSOP4-Jan-10 11:22 
AnswerRe: General Performance Question Pin
Eddy Vluggen4-Jan-10 12:15
professionalEddy Vluggen4-Jan-10 12:15 
GeneralRe: General Performance Question Pin
#realJSOP4-Jan-10 12:21
professional#realJSOP4-Jan-10 12:21 
GeneralRe: General Performance Question Pin
Eddy Vluggen4-Jan-10 13:22
professionalEddy Vluggen4-Jan-10 13:22 
GeneralRe: General Performance Question Pin
#realJSOP4-Jan-10 14:32
professional#realJSOP4-Jan-10 14:32 
AnswerRe: General Performance Question Pin
Mycroft Holmes4-Jan-10 13:13
professionalMycroft Holmes4-Jan-10 13:13 
AnswerRe: General Performance Question Pin
Mycroft Holmes4-Jan-10 19:01
professionalMycroft Holmes4-Jan-10 19:01 
GeneralRe: General Performance Question Pin
#realJSOP4-Jan-10 23:25
professional#realJSOP4-Jan-10 23:25 
GeneralRe: General Performance Question Pin
Mycroft Holmes5-Jan-10 0:12
professionalMycroft Holmes5-Jan-10 0:12 
AnswerRe: General Performance Question Pin
David Skelly5-Jan-10 2:10
David Skelly5-Jan-10 2:10 
GeneralRe: General Performance Question Pin
#realJSOP6-Jan-10 0:35
professional#realJSOP6-Jan-10 0:35 
GeneralRe: General Performance Question Pin
David Skelly6-Jan-10 2:24
David Skelly6-Jan-10 2:24 
AnswerRe: General Performance Question Pin
Tim Carmichael5-Jan-10 6:31
Tim Carmichael5-Jan-10 6:31 
GeneralRe: General Performance Question Pin
#realJSOP6-Jan-10 0:36
professional#realJSOP6-Jan-10 0:36 

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.