Query to show only fields that are not empty! [closed]

1

I have a table with 20 fields which are filled by a for and the amount of data that I tell you to insert. But now I need to show the data of each row, but show me nothing else the fields that have data, so those that are empty do not show them to me. How could the SQL query be? Here I have the row of my table, in this case I want to show only the 8 fields that I have filled, ignoring the ones that are empty. As for code, what is not considered is the SQL statement to avoid empty fields.

    
asked by 12.08.2017 в 22:36
source

1 answer

0

I think you should rethink your database design, because if there was a type of credit of for example 50 quotas you would have 50 columns and for another customer of 9 quotas you would have only 9 columns and 41 empty columns, this would eventually It will bring problems besides that you are not contemplating the issue of BD Normalization.

I leave you with a small example of how the issue of quotas should be related and so you will not have empty fields. I leave the link to the example link

For example to obtain the quotas of id "3" would be more or less the following:

select * from detalle_cuotas where cantidad_id = '3';
    
answered by 13.08.2017 в 00:09