show only those columns which have data value
- by Zankar
I don't known that it is possible or not but i want to ask a question to you as
suppose i have a table as
table1
id | mon | tue | wed | thu | fri | sat | sun
1 | 100 | 200 | 0 | 0 | 0 | 0 | 0
2 | 200 | 0 | 300 | 0 | 0 | 0 | 0
So from given table result should be ...
id | mon | tue | wed |
1 | 100 | 200 | 0 |
2 | 200 | 0 | 300 |
as shown in table1 different columns of week.
If all values in a column is 0 or null then query should ignore to show that column(as shown in result)
Note: if we run a query as select * from table1 it shows all columns.
While I don't wants a query like select id,mon,tue,wed from table1
because no. of showing columns may change.
Please reply to me.
Thank you....