I'd like to check that all (float) values of a set of records are equal. Something like
SELECT ..., equal(my_field) FROM my_table WHERE ... GROUP BY ...
Where equal(my_field) returns true if all values of my_field are equal.
You could use MIN and MAX aggregates
SELECT min(field)=max(field) WHERE ... GROUP BY...
This doesn't take into account NULL values though. If those may be in the column you have to add a check for that.
Also remember that with floats equality is not always simple to check.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With