Hi I have a database table, each row contains lots of columns, only 1 column per row will have a value. Is there a way to get the column that has a value without having to list every column name in the query? For example: SELECT * FROM table WHERE YourColumn IS NOT NULL Code (markup): I dont really want to list all the columns in the table if i dont have to? Is there a way? Cheers
You would have to do some sort of stored procedure and/or nested query to get the actual columns that are null. This would be very complicated if it's even possible.
Sounds like your table isn't normalized. I'd look into properly structuring your database. What is the actual table structure? (i.e. field names and types?)