asking year format with varchar (2013 - 2014)

Discussion in 'MySQL' started by xampeyan, Apr 1, 2014.

  1. #1
    Hi all,
    Actually i want to ask this problem in PHP forum, because i use this query with php.
    This is my problem.

    I have a table with 'year' and 'month' fields, here they are:

    Sorry i cannot create table here

    Why i dont use year type for edu_year because i have to keep this format...
    Year1 - year2

    But i have some problem when i want to sort data with 'where - between' and select max(edu_year), it doesn't work at all.

    Can you solve this problem? i mean, is there any query that can compare some values in varchar type, without changing that field to "year" type, like my case above?
    Really sorry for my english, i hope you get the point.

    Thank you
     
    xampeyan, Apr 1, 2014 IP
  2. pentaxial

    pentaxial Active Member

    Messages:
    101
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    78
    #2
    Hi,

    You can use REPLACE and Explode to make query works
     
    pentaxial, Apr 7, 2014 IP