hi Mate, i need help on this, how can i select column names instead of its value, so it looks like this SELECT COLUMN_NAME WHERE row='002452' AND COLUMN_NAME IS NULL so it will display those NULL columns. row is the location of the id of an employee Hope to get help on this. Cheers! Neil
You can't select only column names because it would not make any sense. In other words, when you select something from column name, you need to enter the name of this column. So take a look at your query: SELECT COLUMN_NAME WHERE row='002452' AND COLUMN_NAME IS NULL This is what you do: you are trying to select the name of column when you already know the name. It's just not logical. Not to mention that you need to select by columns, not by rows; therefore, WHERE row='002452' doesn't make any sense (and will never work) too. Here's the basic tutorial that should be useful to you during your learning steps - http://www.mysqltutorial.org/mysql-select-statement-query-data.aspx
I guess you could do select * from `my_table` where `name` is null or `type` is null or `colour` is null and so on and then in your script you decide what to do You could do some of the sorting in the database, this will only show up the first problem field but you'll get the idea select *, case when `name` is null then 'name' else case when `type` is null then 'type' else case when `colour` is null then 'colour' end have a look at http://sqlfiddle.com/#!9/63e399/5 for a working example