Solved

SQL Define value

Posted on 2007-03-21
2
540 Views
Last Modified: 2013-12-24
I need to find the total (RTotal) of a specific value (Reimbursement) in a table. Everything works except that without line 7 i get the full total of all the values. With line 7 I get a return of $0. There are two defined values in that field. This is a ColdFusion app connecting to an Informix database.

1. <cfquery name="qShowReimbTotal" datasource="expenses">
2. SELECT SUM(root.daily_exp.amount) + SUM(root.daily_exp.mileagetotal) AS RTotal
3. FROM root.daily_exp
4. WHERE ((root.daily_exp.SelectDate BETWEEN #CreateODBCDate(form.StartDate)# AND  #CreateODBCDate(form.EndDate)#)) AND
5. root.daily_exp.id = <cfqueryparam value="#Session.first#" cfsqltype="cf_sql_var"> AND
6. root.daily_exp.submitdate IS NULL AND
7. root.daily_exp.exptype = <cfqueryparam value="Reimbursement">
8. </cfquery>

Thanks for any help.
0
Comment
Question by:aspiegel
2 Comments
 
LVL 6

Accepted Solution

by:
FrivolousSam earned 125 total points
ID: 18763969
I can't see anything wrong with your code.

Try replacing line 2 with
SELECT root.daily_exp.amount, root.daily_exp.mileagetotal, root.daily_exp.id, root.dailyexp.exptype
and removing line 7 then see what you get back from the database.  Perhaps Reimbursement isn't the exact string you need, or you need to change the way in which you're comparing it.

Post your results here.
0
 

Author Comment

by:aspiegel
ID: 18764628
I found the prolem in the database. informix doesn't like nulls which the valu had a null value in it.
Thanks for your help.
0

Featured Post

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This is a guide to setting up a new WHM/cPanel Server to be used for web hosting accounts. It is intended for web hosting company administrators and dedicated server owners. For under $99 per month (considering normal rate of Big Data Cetnters like …
Introduction Hopefully the following mnemonic and, ultimately, the acronym it represents is common place to all those reading: Please Excuse My Dear Aunt Sally (PEMDAS). Briefly, though, PEMDAS is used to signify the order of operations (http://en.…
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question