Results 1 to 3 of 3
  1. #1
    Join Date
    Jan 2002
    Location
    London
    Posts
    73

    Unanswered: Convert Date to Month

    Hi

    I am new to SQL am trying to convert the dates from a table to months and year in a sql query

    Table name is

    Sales

    Field is called Sales Date

    I want to convert the Sales Date to Month to work out monthly sales

    Thank you

  2. #2
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    Quote Originally Posted by Hemish View Post
    Field is called Sales Date
    really? with a space in the column name?

    what is the DATATYPE of this column?
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

  3. #3
    Join Date
    Jan 2002
    Location
    London
    Posts
    73
    Sorry i figured it out it was simple. The field name was called TBI_DATE was just using sales date as an example

    select DATENAME(MM, dbo.ASC_TBI_TBL.TBI_DATE) as month

    Thank you for having a look

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •