Inmagic Forums
Inmagic Forums
ODBC
Can you use CASE or IF in a SELECT statement to make a descision?|
Go
![]() |
New
![]() |
Find
![]() |
Notify
![]() |
Tools
![]() |
Reply
![]() |
|
How can you write a select statement that makes a decision based on the value of a field?
I've tried SELECT CASE WHEN Title IS NULL THEN ' ' ELSE Title END FROM DatabaseName but it complains that "Expected lexical element not found: FROM". Any suggestions? |
|||
|
I found a solution to my problem
SELECT {fn IFNULL(Title + ',','')} FROM Database If the Title field is NULL, the concatenating NULL + ',' evaluates to NULL which means IFNULL will return the empty string ''. If the Title field is not null, then concatenating Title + ',' evaluates to a string "This is the Title," which is returned by IFNULL |
||||
|
| Previous Topic | Next Topic | powered by eve community |
| Please Wait. Your request is being processed... |
|
Inmagic Forums
Inmagic Forums
ODBC
Can you use CASE or IF in a SELECT statement to make a descision?
