سؤال

Sample original value of inputDate

inputDate
2013-11-19
2013-11-20
2013-11-22
2013-12-04

i want the result to be return in:

Nov-2013
Nov-2013
Nov-2013
Dec-2013

im using the query as below to get the result.

SELECT CONCAT(DATE_FORMAT(inputDate, '%b'), '-' , YEAR(inpuDate)) AS entryDate FROM table
  • datatype of inputDate is 'Date'
  • running at local has no problem
  • running at server result return "BLOB".

how to show the result at server side? i double check the datatype, and restore the data from server to my local. nothing helped. there is no 'NULL' value inside this field

هل كانت مفيدة؟

المحلول

Why not just do (%Y will give you the year part):

select DATE_FORMAT(inputDate, '%b-%Y') AS entryDate from `table`
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top