This is a discussion on "Month and Year" within the Databases section. This forum, and the thread "Month and Year are both part of the Program Your Website category.
|
|
|
|
|
![]() |
||
Month and Year
|
||
| Notices |
![]() |
|
|
LinkBack | Thread Tools |
|
#1
|
|||
|
|||
|
Month and Year
Hi,
I need to get the totals for each month from a SQL Server DB. I can do it but the problem is I then need to chart it so I need to group on the month/yyyy. So the query needs to have an "AS monthyear". I can get the month and the year separately using DatePart but how do I get them together? Thanks, Jen |
|
#2
|
||||
|
||||
|
Re: Month and Year
METHOD 1: (BAD)
CAST the month and year as strings and join them into one string... Use the string as the primary key. METHOD 2: (GOOD) Group by month and year individually (2 fields) The 2 fields together form your primary key. then u can still display month and year together in one string if you want to How r u presenting this info? in a website?
__________________
Diego - Web-Developer & London SEO Expert jQuery Plugins: Multiple File Upload, Star Rating, FCKEditor | NEW: XML to JSON
Last Blog Entry: Random String in Javascript (Apr 21st, 2008)
|
![]() |
| Tags |
| month, year |
| Thread Tools | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| $5 per year for a pr5 link | Jasonb | Link Building and Link Sales | 1 | Jan 30th, 2007 10:30 |