format query result

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a query that lists total $ amount and service hours and regular hours
I have created a column where I want the cost per hour. I cannot make it
tell it to me in a decimal format, I get 26.00 not 26.25. There must be an
easy answer but I have tried everything including I can think of. Thanks
 
thanks, I have. Oh well I'll keep trying!

Chris2 said:
Thanks

Akrt48,

Without knowing the exact data types of all the columns and/or
variables being operated on, it is difficult to say for sure.

But the typical problem is that INTEGER (BYTE, LONG, etc.) data types
get in the way somewhere and truncate the fractions.

Make sure you are using DOUBLE data types.


Sincerely,

Chris O.
 
Akrt48 said:
I have a query that lists total $ amount and service hours and regular hours
I have created a column where I want the cost per hour. I cannot make it
tell it to me in a decimal format, I get 26.00 not 26.25. There must be an
easy answer but I have tried everything including I can think of.
Thanks

Akrt48,

Without knowing the exact data types of all the columns and/or
variables being operated on, it is difficult to say for sure.

But the typical problem is that INTEGER (BYTE, LONG, etc.) data types
get in the way somewhere and truncate the fractions.

Make sure you are using DOUBLE data types.


Sincerely,

Chris O.
 
SELECT TESTCOSTS.[slipdate By Month], TESTCOSTS.unit, TESTCOSTS.[Sum Of
litres], TESTCOSTS.[Sum Of COST], TESTCOSTS.[Sum Of SumOfProductionHours],
+[Sum Of litres]\[Sum Of SumOfProductionHours] AS LITHR, +[Sum Of COST]\[Sum
Of SumOfProductionHours] AS CSTHR
FROM TESTCOSTS;
slipdate By Month unit Sum Of litres Sum Of COST Sum Of
SumOfProductionHours LITHR CSTHR
April 2005 B13 5692 $3,927.48 265.40 21 $14.00
Not sure if this makes sense but the LITHR should be 21.45 and CSTHR should
be 14.80
 
I have the answer, I just researched this site some more. I have my division
\ the wrong way apparently that is only for integers. Works perfect / this
way!

Akrt48 said:
SELECT TESTCOSTS.[slipdate By Month], TESTCOSTS.unit, TESTCOSTS.[Sum Of
litres], TESTCOSTS.[Sum Of COST], TESTCOSTS.[Sum Of SumOfProductionHours],
+[Sum Of litres]\[Sum Of SumOfProductionHours] AS LITHR, +[Sum Of COST]\[Sum
Of SumOfProductionHours] AS CSTHR
FROM TESTCOSTS;
slipdate By Month unit Sum Of litres Sum Of COST Sum Of
SumOfProductionHours LITHR CSTHR
April 2005 B13 5692 $3,927.48 265.40 21 $14.00
Not sure if this makes sense but the LITHR should be 21.45 and CSTHR should
be 14.80
KARL DEWEY said:
Post a sample of your data, SQL, and results so it can be analyzed.
 
Akrt48 said:
I have the answer, I just researched this site some more. I have my division
\ the wrong way apparently that is only for integers. Works perfect / this
way!

:

Akrt48,

Newsgroup searches. Woot!


Sincerely,

Chris O.
 
\ is an integer division. If you use \, Access will round both input
numbers and then do a integer division ignoring the remainder.
 
Back
Top