Converting minus to zero by using query "case when.." in Form Grid is not ok

Confluence User - 24 May, 2018

Hallo Expert,

I'm using query :

select id, 

CASE WHEN column < 0 THEN 0 ELSE column END as A

from table

in order to convert minus result in a query to make it 0 (zero). It is ok in my Navicat but not ok in my Form Grid.

Is there any option for me to convert minus < 0 to zero  ?

 

Thank you

forms

1


25 May, 2018
confluenceUser
confluenceUser

It is solved.

The values in the form grid must be the same with alias in the query.

So, query with :

select greatest(0, test.A-test.B) as myResult from test;

or

SELECT a, b, IF(a-b<0,0,a-b) as myResult FROM test;

or

select case when test.A - test.B >= 0 then test.A - test.B else 0 end as myResult from test;

is no problem. Thank you.

RELATED QUESTIONS

Your answer


To answer a question you'll need an account.

Print