Welcome to the Excel Forum

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.

Please Register to Remove these Ads

Please Register to Remove these Ads



Reply
  #1  
Old 06-30-2009, 07:30 PM
pr4t3ek's Avatar
pr4t3ek pr4t3ek is offline
Valued Forum Contributor
 
Join Date: 13 Oct 2008
Location: Never
MS Office Version:2003
Posts: 307
pr4t3ek is becoming part of the community
Query to Show 0 if no match found

Please Register to Remove these Ads

Hi,
I have the following SQL code:

I would like to know if there is a way to bring back a "0" if no matches are found for all the items in the "DOBTable" table.

Code:
SELECT DISTINCT Name, DOB
FROM NameTable INNER JOIN DOBTable ON DOBTable.Name = NameTable.Name
__________________
--
Regards
PD
Reply With Quote
  #2  
Old 06-30-2009, 07:44 PM
Chance2 Chance2 is offline
Forum Contributor
 
Join Date: 01 Apr 2009
Location: Irvine, CA
MS Office Version:Excel 2003
Posts: 160
Chance2 has an addiction to Excel
Re: Query to Show 0 if no match found

That depends on the version of SQL you are using, for example Access uses NZ(field, value if null). MS SQL uses IsNull(field, value if null), and Oracle uses NVL(field, value if null).
Reply With Quote
  #3  
Old 07-01-2009, 12:11 AM
pr4t3ek's Avatar
pr4t3ek pr4t3ek is offline
Valued Forum Contributor
 
Join Date: 13 Oct 2008
Location: Never
MS Office Version:2003
Posts: 307
pr4t3ek is becoming part of the community
Re: Query to Show 0 if no match found

Access it is
__________________
--
Regards
PD
Reply With Quote


Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes Rate This Thread
Rate This Thread:

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 Off
Pingbacks are Off
Refbacks are Off

Forum Jump