sql - Converting detailed Date column into grouped by month column format -


i attempting take column entitled "creat_dttm" table tempso_inv_data holds "creation date" of invoice (and associated data) , convert date format 1 follows equal sign below, in new table , title column month. grouping invoices each month, corresponding month in format "??/1/2014". still new sql 1 stumped me, hope explanation not convoluted.

  creat_dttm                   month 2014-01-01 00:33:58.000      = 1/1/2014 2014-01-01 07:40:01.000      = 1/1/2014 2014-01-03 01:50:12.000      = 1/1/2014 2014-02-18 11:42:13.000      = 2/1/2014  2014-02-20 07:49:11.000      = 2/1/2014 2014-04-09 06:02:36.000      = 4/1/2014 

select cast(month(creat_dttm) varchar(2)) + '/1/' + cast(year(creat_dttm) varchar(4)) month  tempso_inv_data  

Comments

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -