Link to home
Start Free TrialLog in
Avatar of jglazer63
jglazer63

asked on

SQL Boolean formula in select

I need the syntax for:

select (a > b) as test

Basically I need to test if value a is greater than value b in a select statement and return the boolean response.  The above won't work.

I'm sure this is easy but I'm missing something.  I need all the rows, not just if a>b (where) but actually a true or false.

Thanks!
ASKER CERTIFIED SOLUTION
Avatar of waltersnowslinarnold
waltersnowslinarnold
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SELECT	* ,
CASE	WHEN	A > B  
THEN	'TRUE'
ELSE	'FALSE' 
END	AS	BOOLVAL 
FROM	TABLE1

Open in new window

output is:User generated image
Avatar of jglazer63
jglazer63

ASKER

Worked perfect!