473,386 Members | 1,791 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Problem with query result

Hello,

I have a query with 2 sub queries.
Each query returns one value.
My query should sum these values and display the sum.

For example:
sub query 1 returns 5
sub query 2 returns 10
my query should display 15

My problem is when one query returns NULL.

For example:
sub query 1 returns NULL
sub query 2 returns 10
my query should display NULL

How can I solve this in the select statement ?

Thank you
Gil D.

Jun 20 '06 #1
3 1266
On 19 Jun 2006 17:31:49 -0700, "Gil D." <sn********@walla.com> wrote:

That's exactly what it will do.
Note that any arithmetic with Null will result in Null.

If you think your queries don't return Null, test each one with
?IsNull(DLookup(...)) in the immediate window. Perhaps one of them is
returning "" rather than Null.

-Tom.

Hello,

I have a query with 2 sub queries.
Each query returns one value.
My query should sum these values and display the sum.

For example:
sub query 1 returns 5
sub query 2 returns 10
my query should display 15

My problem is when one query returns NULL.

For example:
sub query 1 returns NULL
sub query 2 returns 10
my query should display NULL

How can I solve this in the select statement ?

Thank you
Gil D.


Jun 20 '06 #2
Hello,

Thank you for your help.
My query returns NULL sometimes.
I found that the NZ(MyQueryResult,0) function can solve my problem
(returns 0 instead of NULL).

Thank you
Gil D.

Jun 20 '06 #3
On 20 Jun 2006 01:35:58 -0700, "Gil D." <sn********@walla.com> wrote:

You wrote:
my query should display NULL

You meant:
my query should display 0

-Tom.

Hello,

Thank you for your help.
My query returns NULL sometimes.
I found that the NZ(MyQueryResult,0) function can solve my problem
(returns 0 instead of NULL).

Thank you
Gil D.


Jun 20 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

11
by: James | last post by:
My form and results are on one page. If I use : if ($Company) { $query = "Select Company, Contact From tblworking Where ID = $Company Order By Company ASC"; }
2
by: Cliff Roman | last post by:
I have been trying to find the answer on the postnuke forums and I have even tried Sitepoint but I am unable to find an answer. So now I am asking here in hopes that someone may have an idea ...
2
by: justme | last post by:
Dears I have created the following page to display my data <head> <style type="text/css"> body, td, th, h1, h2 {font-family: sans-serif;} body, td, th {font-size: 100%;} a:link {...
9
by: Bartosz Wegrzyn | last post by:
I need help with sessions. I createt set of web site for nav with authorization. first I go into main.php which looks like this: <?php //common functions include_once '../login/common.php';...
2
by: mike | last post by:
Ok, I'll admit I'm VERY new to ASP but I simply cannot seem to get this to work. The problem is probably obvious but I just can't seem to find it. I'm trying to query an Oracle DB on another...
0
by: hiisikukko | last post by:
I have created project management software with Java and MySql and i works fine. This applet gets and writes information directly to MySql database. Problem is that those sqlClauses below(update...
3
by: auron | last post by:
Hi there, I have a really stupid and banal problem with showing the results of a MySQL query in PHP, preciselly with MySQL count() function that gives to a variable in PHP the result. NOTE:...
11
by: ste | last post by:
Hi there, Further to my recent posts where I've received excellent help from Rik and Jerry, I've ended up with an image gallery on my website that displays images in a table, 3 images per row. ...
6
by: saeedeh | last post by:
hi to all i have some problem with fetching my form enteries. the problem is when i post some enteries through a form to a databse called 'applicant' and try to fetch and print it nothing appears.it...
6
by: jej1216 | last post by:
I am trying to put together a PHP search page in which the user can select none, one, two, or three fields to search, and then the results php will build the SQL with dynamic where caluses to reflect...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.