Sorting results by year and date
wantjoule_at_ncl.com
Date: 04/18/04
- Next message: Vishal Parkar: "Re: Sorting results by year and date"
- Previous message: ashleyT: "Re: another question"
- Next in thread: Vishal Parkar: "Re: Sorting results by year and date"
- Reply: Vishal Parkar: "Re: Sorting results by year and date"
- Messages sorted by: [ date ] [ thread ]
Date: Sat, 17 Apr 2004 19:47:33 -0700
I Have a simple query that i am running. but i need the
results to only show each month only once, this one has
stumpted me! :)
I know why it is happening but i cant solve it
SO should i be using a cast command or somthing else to
get around this problem?
Below is my query and the result of when it is run.
Willa
SELECT
DATENAME(YEAR,SAIL_DAT) AS SAIL_YEAR,
DATENAME(MONTH,SAIL_DAT) AS SAIL_MONTH
FROM dbo.IPS_POINTS
WHERE RES_AGENT_CD = 'PLUMB_N'
GROUP BY DATENAME(YEAR,SAIL_DAT),DATENAME
(MONTH,SAIL_DAT),SAIL_DAT
ORDER BY SAIL_DAT
2004 January
2004 April
2004 April
2004 May
2004 May
2004 June
2004 June
2004 June
2004 June
2004 July
2004 August
2004 November
2004 November
2004 December
2005 February
2005 May
- Next message: Vishal Parkar: "Re: Sorting results by year and date"
- Previous message: ashleyT: "Re: another question"
- Next in thread: Vishal Parkar: "Re: Sorting results by year and date"
- Reply: Vishal Parkar: "Re: Sorting results by year and date"
- Messages sorted by: [ date ] [ thread ]