
August 18th, 2004, 06:27 AM
|
|
Registered User
|
|
Join Date: Apr 2004
Posts: 9
Time spent in forums: 27 m 6 sec
Reputation Power: 0
|
|
|
Adding conditions (if/else) when selecting fields
We have three fields in a table: firstname, Surname & Organisation. Firstname & surname will always be filled but in most cases organisation is NULL.
Part of what these fields will be used for is a mailshot. If there is no organisation data then the mailshot will open with 'Dear Firstname Surname, ' but if the organisation is present they would like 'Dear Organisation'.
Is it possible to create a select state that checks the organisation field, and if a value is present return that value else return the firstname, surname combination? I have tried various things but I cannot get it to work.
I know the ideal situation would be to do this type of condition check at scripting level (PHP, ASP, Visual Basic) but my bosses would like to try it at SQL level. 
|