Boolean expression in select clause 
Author Message
 Boolean expression in select clause
Hi

A simple question ?

Is It possible to a get a bit returned from a boolean
expression in a select clause:

Select (Column4 > 10 and Column4 < 15), ....From TableX

--------

thanks

Asger



Mon, 18 Oct 2004 21:08:30 GMT
 Boolean expression in select clause

Asger,

  You can use the CASE expression:

select
  case when (Column4 > 10 and Column4 < 15)
  then 1 else 0 end,
...
from TableX

Steve Kass
Drew University

Quote:

> Hi

> A simple question ?

> Is It possible to a get a bit returned from a boolean
> expression in a select clause:

> Select (Column4 > 10 and Column4 < 15), ....From TableX

> --------

> thanks

> Asger



Mon, 18 Oct 2004 21:20:15 GMT
 Boolean expression in select clause
Is this what you need?

select (case when Column4 between 11 and 14 then 1 else 0 end)

--

/Per Holje, MCDBA


Quote:
> Hi

> A simple question ?

> Is It possible to a get a bit returned from a boolean
> expression in a select clause:

> Select (Column4 > 10 and Column4 < 15), ....From TableX

> --------

> thanks

> Asger



Mon, 18 Oct 2004 21:17:20 GMT
 Boolean expression in select clause
Hi,

Maybe like this

SELECT
    CASE
        WHEN (Column4 < 10) AND (Column4 < 15) THEN 1
        ELSE 0
    END As ColName, ...
FROM TableX

/fredrik hansson


Quote:
> Hi

> A simple question ?

> Is It possible to a get a bit returned from a boolean
> expression in a select clause:

> Select (Column4 > 10 and Column4 < 15), ....From TableX

> --------

> thanks

> Asger



Mon, 18 Oct 2004 21:45:12 GMT
 
 [ 4 post ] 

 Relevant Pages 

1. SQL SELECT with boolean expression

2. Using expressions in a SELECT Clause

3. Using expressions AS a select clause

4. Case expression in the select and where clauses

5. Referencing expressions in other expressions in a single select statement

6. if statement within if boolean expression

7. Store result of a boolean expression into a variable for subsequent testing

8. How are boolean expressions evaluated?

9. need help writing boolean expression

10. PL/SQL evaluating boolean expression

11. boolean logic in Sybase expressions

12. Is boolean expression short circuited?


 
Powered by phpBB® Forum Software