If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > ANSI SQL > combining fields (sort of)

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 01-22-04, 12:10
raylove raylove is offline
Registered User
 
Join Date: Jan 2004
Posts: 6
Talking combining fields (sort of)

Hi,
Hope this is neither too obvious or laughably impossible, else I'll
just have to be embarrased.
Is there any way to do this:

SELECT field1 if it is not NULL, else SELECT field2..??

The way this dbase is set up, I'm just about suicidal.
THANKS for any help!
Reply With Quote
  #2 (permalink)  
Old 01-22-04, 12:28
andrewst andrewst is offline
Moderator.
 
Join Date: Sep 2002
Location: UK
Posts: 5,171
Re: combining fields (sort of)

Use the COALESCE function (or NVL if using Oracle):

COALESCE(field1,field2)
__________________
Tony Andrews
http://tinyurl.com/tonyandrews
Reply With Quote
  #3 (permalink)  
Old 01-22-04, 14:13
raylove raylove is offline
Registered User
 
Join Date: Jan 2004
Posts: 6
Re: combining fields (sort of)

Quote:
Originally posted by andrewst
Use the COALESCE function (or NVL if using Oracle):

COALESCE(field1,field2)

NVL did it! THANKS SO MUCH! I'd looked at that earlier but
the sql book I have only shows literals as being valid 'convert-to'
values. Shoulda just tried it. Thanks again!!!!!
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On