locked
mysq concat error RRS feed

  • Question

  • User410067686 posted

    CONCAT(MONTHNAME(i.time), ' ', YEAR(i.time), c.categoryName)
     
    Error Code: 1271. Illegal mix of collations for operation 'concat'

    Thursday, October 30, 2014 7:53 AM

All replies

  • User-1360095595 posted

    I believe YEAR() returns an int. So you need to cast that to varchar. 

    Thursday, October 30, 2014 8:07 AM
  • User410067686 posted

    How do I proceed?

    Thursday, October 30, 2014 9:04 AM
  • User410067686 posted

    i.time is a timestamp and categoryName is a varchar

    Thursday, October 30, 2014 9:31 AM
  • User-1360095595 posted

    Try changing this: YEAR(i.time)

    To this:  CONVERT(varchar(5), YEAR(i.time))

    Thursday, October 30, 2014 5:06 PM