I would like to select only columns that has only data in mysql.
In example, i have table1 as the follwing:
Table1 NAME VAL1 VAL2 VAL3 VAL4 A 1 2 B 2 3 C 3 3
select name,val1,val2,val3,val4 from Table1;
How can i select only Name,val1,val2 in mysql ?
Result: Table1 NAME VAL1 VAL2 A 1 2 B 2 3 C 3 3
You HAVE to deal with
null values and what you trying to achieve is NOT possible. Because you can't predict how many columns won't be
NULL before executing the statement.
There are many easy ways in PHP or other languages tho, sorting out your results to fit your needs.