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 > Null values in queries...

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 08-09-04, 01:51
mslinn mslinn is offline
Registered User
 
Join Date: Aug 2004
Posts: 1
Null values in queries...

I am relatively new to SQL and Access...

I am experiencing a problem that involves 3 queries in my 2000 access db.
The first 2 queries each perform a different multiplication calculation, and both work fine when I run them individually. But on the third query, I am trying to sum the values derived in the 2 prior queries (grouping by pk RAA_Num), and am finding that if the derived value of EITHER ONE of the first 2 queries is NULL, then on the third query, NEITHER will show up...

This is the code for that third query I have so far...I am trying to make it so that if a value for one query is null, it will be replaced with 0...

SELECT Expense.RAA_Num, (Sum(IIf(isnull([AA TOTAL CAR LODGE PERDIEM].AATOTALCARLODGEPERDIEM=0, [AA TOTAL MISC].AATOTALMISC=0)))) AS Expr1

FROM (Expense INNER JOIN [AA TOTAL CAR LODGE PERDIEM] ON Expense.RAA_Num = [AA TOTAL CAR LODGE PERDIEM].RAA_Num) INNER JOIN [AA TOTAL MISC] ON [AA TOTAL CAR LODGE PERDIEM].RAA_Num = [AA TOTAL MISC].RAA_Num

GROUP BY Expense.RAA_Num;

Any suggestions would be greatly appreciated! I am so stuck!
Reply With Quote
  #2 (permalink)  
Old 08-09-04, 08:41
r123456 r123456 is offline
Registered User
 
Join Date: Sep 2003
Location: The extremely Royal borough of Kensington, London
Posts: 778
NZ(column, 0)
__________________
Bessie Braddock: Winston, you are drunk!
Churchill: And Madam, you are ugly. And tomorrow, I'll be sober, and you will still be ugly.
Reply With Quote
  #3 (permalink)  
Old 08-10-04, 00:52
orababa@kshema orababa@kshema is offline
Registered User
 
Join Date: Nov 2003
Location: Bangalore,India
Posts: 51
Nvl(column,0)
Cheers
Reply With Quote
  #4 (permalink)  
Old 08-10-04, 02:37
r123456 r123456 is offline
Registered User
 
Join Date: Sep 2003
Location: The extremely Royal borough of Kensington, London
Posts: 778
NVL is Oracle, not Access.
__________________
Bessie Braddock: Winston, you are drunk!
Churchill: And Madam, you are ugly. And tomorrow, I'll be sober, and you will still be ugly.
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