Click here to Skip to main content
15,890,512 members
Home / Discussions / Database
   

Database

 
AnswerRe: SQL Between Pin
Ashfield15-Jul-09 1:19
Ashfield15-Jul-09 1:19 
AnswerRe: SQL Between Pin
Niladri_Biswas16-Jul-09 18:13
Niladri_Biswas16-Jul-09 18:13 
QuestionEXECUTING VB.NET DLL Pin
ps_prakash0215-Jul-09 0:08
ps_prakash0215-Jul-09 0:08 
AnswerRe: EXECUTING VB.NET DLL Pin
Manas Bhardwaj17-Jul-09 4:47
professionalManas Bhardwaj17-Jul-09 4:47 
GeneralRe: EXECUTING VB.NET DLL Pin
ps_prakash0230-Jul-09 23:16
ps_prakash0230-Jul-09 23:16 
QuestionNeed Query for getting MONTHNAME,YEAR from my DateColumn SQLSERVER Pin
kish2014-Jul-09 20:23
kish2014-Jul-09 20:23 
AnswerRe: Need Query for getting MONTHNAME,YEAR from my DateColumn SQLSERVER Pin
Blue_Boy14-Jul-09 21:28
Blue_Boy14-Jul-09 21:28 
AnswerRe: Need Query for getting MONTHNAME,YEAR from my DateColumn SQLSERVER Pin
infneeta15-Jul-09 23:27
infneeta15-Jul-09 23:27 
Hi,
I have below records in my table 'Sales'
ID SalesName LastUpdated
-------------------------------------------------
1 S1 2009-07-16 13:27:23.890
2 S2 2009-08-16 13:32:58.127
3 S3 2009-08-16 13:33:01.987
4 S4 2009-08-16 13:34:21.733
5 S5 2009-09-16 13:32:40.703
6 S6 2011-01-16 13:32:23.703
7 S7 2011-02-16 13:32:23.703
8 S8 2011-02-16 13:32:23.703
9 S9 2011-03-16 13:32:23.703
10 S10 2011-07-16 13:32:23.703
--------------------------------------------------

Below query gives me the count of sales for different months on yearly basis.

SELECT DISTINCT MonthCount = (SELECT COUNT(DATEPART("mm",LastUpdated)) FROM Sales
WHERE DATEPART("yy",LastUpdated) = DATEPART("yy",p.LastUpdated)
AND DATEPART("mm",LastUpdated) = DATEPART("mm",p.LastUpdated)) ,
"Month" = DATENAME(Month,LastUpdated),"Year"=DATEPART("yy",p.LastUpdated)
FROM Sales p ORDER BY DATEPART("yy",p.LastUpdated)


Here is my desired result:
MonthCount Month Year
-----------------------------
1 July 2009
1 September 2009
3 August 2009
1 January 2011
1 July 2011
1 March 2011
2 February 2011
QuestionLinked SQL Servers problem Pin
goodideadave14-Jul-09 7:18
goodideadave14-Jul-09 7:18 
AnswerRe: Linked SQL Servers problem Pin
Mycroft Holmes14-Jul-09 19:32
professionalMycroft Holmes14-Jul-09 19:32 
GeneralRe: Linked SQL Servers problem Pin
goodideadave15-Jul-09 6:20
goodideadave15-Jul-09 6:20 
GeneralRe: Linked SQL Servers problem Pin
Mycroft Holmes15-Jul-09 12:31
professionalMycroft Holmes15-Jul-09 12:31 
QuestionAverage value after 3 time intervals. Pin
Robert Vrinceanu14-Jul-09 5:52
Robert Vrinceanu14-Jul-09 5:52 
AnswerRe: Average value after 3 time intervals. Pin
Luc Pattyn14-Jul-09 6:22
sitebuilderLuc Pattyn14-Jul-09 6:22 
GeneralRe: Average value after 3 time intervals. Pin
Robert Vrinceanu14-Jul-09 8:52
Robert Vrinceanu14-Jul-09 8:52 
QuestionSetting up User Accounts. Pin
Droze14-Jul-09 5:35
Droze14-Jul-09 5:35 
AnswerRe: Setting up User Accounts. Pin
DoctorMick14-Jul-09 6:23
DoctorMick14-Jul-09 6:23 
GeneralRe: Setting up User Accounts. Pin
Droze14-Jul-09 7:14
Droze14-Jul-09 7:14 
AnswerRe: Setting up User Accounts. Pin
ScottM115-Jul-09 2:43
ScottM115-Jul-09 2:43 
QuestionAS 400 System tables Pin
Ersan Ercek14-Jul-09 0:28
Ersan Ercek14-Jul-09 0:28 
AnswerRe: AS 400 System tables Pin
David Skelly14-Jul-09 6:19
David Skelly14-Jul-09 6:19 
AnswerRe: AS 400 System tables Pin
Giorgi Dalakishvili14-Jul-09 6:21
mentorGiorgi Dalakishvili14-Jul-09 6:21 
Questionhow to know current date and time Pin
janani1313-Jul-09 21:37
janani1313-Jul-09 21:37 
AnswerRe: how to know current date and time Pin
Eddy Vluggen13-Jul-09 22:31
professionalEddy Vluggen13-Jul-09 22:31 
GeneralRe: how to know current date and time Pin
janani1313-Jul-09 23:26
janani1313-Jul-09 23:26 

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.