Month and Year

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.



Go Back   Webforumz.com > Main Forums > Program Your Website > Databases

Notices


Reply
 
LinkBack Thread Tools
  #1 (permalink)  
Old Jun 26th, 2006, 18:31
New Member
Join Date: Jun 2006
Location: Baltimore,MD
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
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
Reply With Quote

  #2 (permalink)  
Old Jun 26th, 2006, 20:01
spinal007's Avatar
Moderator
Join Date: Mar 2004
Location: Good Ol'London
Age: 23
Posts: 1,650
Blog Entries: 1
Thanks: 0
Thanked 4 Times in 4 Posts
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?
Last Blog Entry: Random String in Javascript (Apr 21st, 2008)
Reply With Quote
Reply

Tags
month, year

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
I know just a little more than a year ago! caminowebmaster Introduce Yourself 6 Jun 19th, 2007 10:09
$5 per year for a pr5 link Jasonb Link Building and Link Sales 1 Jan 30th, 2007 09:30
Start New Year with something new dedesigns Introduce Yourself 1 Jan 10th, 2006 21:25


All times are GMT. The time now is 07:46.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC8
© 2003-2008 Webforumz.com : All Rights Reserved

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43