1064 && You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'AND colour <> '' AND colour IS NOT NULL AND ' at line 7
El problemo: SELECT colour, min(id) as id FROM writing_instruments_stock WHERE wrt_instrument_id = AND colour <> '' AND colour IS NOT NULL AND hidden = 0 GROUP BY colour ORDER BY id