Help | Site Map
Connecting Tech Pros Worldwide
Reply
 
LinkBack Thread Tools
  #1  
Old September 4th, 2008, 04:33 PM
Newbie
 
Join Date: Aug 2008
Posts: 12
Default why this query is making rubbish result?

the bill,paid and exempted are floating point variable.
but when i run the query, the column of due outputs just blank while the sum(bill.exempted) returns 0. which is rubbish.
Why it happens, why the due column is 0 whenever the sum(bill.exempted) is zero?

Can anyone say it.

The query is placed below:

Expand|Select|Wrap|Line Numbers
  1. select cc, sum(bill)as b,sum(paid)as p, sum(exempted) as ex, sum(bill.bill-bill.paid)-sum(bill.exempted)  AS due from bill group by cc
Reply
  #2  
Old September 5th, 2008, 08:02 AM
Administrator
 
Join Date: Sep 2006
Posts: 11,312
Default

Add a where clause to select only where those columns are not null.
Reply
Reply

Bookmarks

Thread Tools

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 Off
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over network members.
Post your question now . . .
It's fast and it's free

Popular Articles