8 Replies Latest reply: Dec 7, 2012 11:30 AM by Jim Feng

# Help: How to multiply??

I want to calculate cubic space (width * height * length).

so here i have measurements for width, height and length.

what is the expression for cubic space???

• ###### Re: Help: How to multiply??

It's width * height * length if your field names are 'width', 'height' and 'length':

object, width, height, length,

width * height * length as cubic_space

from ...somewhere;

• ###### Re: Help: How to multiply??

CompletedCubicMeasure:

*,

width,

length,

height,

OrderNo,

width * Length * Height as CubicSpace;

SQL SELECT

*

FROM CourierComplete.dbo.CompletedOrderPackages;

this is my code, but it was returned with error. can you please tell me where i made the mistake at?

• ###### Re: Help: How to multiply??

You will get an error that field names must be unique. The * loads all field names. You then load width, lenght, height and OrderNo again without renaming them.

• ###### Re: Help: How to multiply??

Hi Gysbert,

i am trying to sum up all the width and multiply by all the length, and so on, but my equation shows oledb failed...

my Code:

CompletedCubicMeasure:

(sum(width) * sum(length) * sum(height))/1728 as CubicSpace,

*;

SQL SELECT width,

length,

height,

OrderNo

FROM CourierComplete.dbo.CompletedOrderPackages;

• ###### Re: Help: How to multiply??

(sum(width) * sum(length) * sum(height))/1728 as CubicSpace

To begin with this is probably not calculating what you want. It first sums all the lenghts, all the widths and all the heights and than multiplies the sums. This is something completely different from sum( widht*length*height).

Next if you use an aggregation function like sum, you need to use the group by clause. Your load script would look like this:

Temp:

SQL SELECT width,

length,

height,

OrderNo

FROM CourierComplete.dbo.CompletedOrderPackages;

CompletedCubicMeasure:

load OrderNo, (sum(width) * sum(length) * sum(height))/1728 as CubicSpace

resident Temp group by OrderNo;

drop Table Temp;

• ###### Re: Help: How to multiply??

Thank you so much

• ###### Re: Help: How to multiply??

If you do have records that contain your measures, maybe like this

width*height*length as CubicSpace

INLINE [

room, width, height, length

A, 10, 20, 30

B, 5,8,7

];

• ###### Re: Help: How to multiply??

hi, i dont understand anything after inline

INLINE [

room, width, height, length

A, 10, 20, 30

B, 5,8,7

];

can you please tell me what this is, and what is room and those numbers???