Combine distinct columns in mysql database
Posted on 2011-02-23
I'm trying to combine 9 size columns in my database into 1, I currently have size1, size2, size9.
I have an autosuggest field which the user can input a size and the results are populated ala Google.
Obviously I want this field to cover all 9 fields and to only display distinct sizes, not repeating duplicated sizes which there will be in the db.
I've got the distinct part of it working, but can't seem to work out how to combine the columns, I've tried CONCAT, but realised that wasn't really what I was looking for.
This is about as far as I've got:
SELECT DISTINCT (size1, size2, size3, size4, size5, size6, size7, size8, size9) FROM tiles