Re: MySQL query - not sure if you can only select fields > 0?
A Decimal(3) can't hold the value 1.5; it'd be coerced to 2.
Dynamically including or excluding columns from a query result based on column values can't be done in basic sql, it can be done in convoluted prepared statements, and it's more easily done in a complete computer language like the the many app languages having MySQL APIs---PHP, Python, Java, C# &c.
The fact that you're asking about such a possibility strongly suggests that the table hasn't been designed well for the query you want. You might find your query easier with a better normalised tanle structure like decimal(3,1), field varchar(1) ) where the field column encodes the info buried in your field1...5 columns.
Subject
Written By
Posted
Re: MySQL query - not sure if you can only select fields > 0?
July 12, 2018 07:34PM
Sorry, you can't reply to this topic. It has been closed.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion
of Oracle or any other party.