On Thu, Aug 20, 2009 at 03:30:00PM +0300, Sim Zacks wrote:
> In other words, I have a conversion table of all different units. If
> there is no conversion between 2 units (such as volume and area) then
> the sum returns null.
>
>
> Shouldn't that return NULL IOW unkno
In other words, I have a conversion table of all different units. If
there is no conversion between 2 units (such as volume and area) then
the sum returns null.
Shouldn't that return NULL IOW unknown ?
Karsten
I am not familiar with returning unknown. I know that accord
On Thu, Aug 20, 2009 at 10:36:37AM +0300, Sim Zacks wrote:
> In other words, I have a conversion table of all different units. If
> there is no conversion between 2 units (such as volume and area) then
> the sum returns null.
Shouldn't that return NULL IOW unknown ?
Karsten
--
GPG key ID E40713
> My query contains select ..,
> sum_unitvalues(qty,unitid),sum_units(unitid),...
> then the units returned do not have to be known in advance, which is
> important in this specific project.
>
To give an example of my required result set:
unitid
1 = mm
2 = inch
3 = ft
4 = gram
create table te
>> That would be true if all units were always convertible to mm, but we
>> have volume also, we also have feet etc.. So that the easiest and
>
> How did you plan on solving that in your multiple-argument aggregate?
> Fake their value by adding 0? That's no different for my suggested
> solution.
W
On 18 Aug 2009, at 6:51, Sim Zacks wrote:
That would be true if all units were always convertible to mm, but we
have volume also, we also have feet etc.. So that the easiest and
How did you plan on solving that in your multiple-argument aggregate?
Fake their value by adding 0? That's no diff
That would be true if all units were always convertible to mm, but we
have volume also, we also have feet etc.. So that the easiest and
cleanest thing to do, with out having to throw the all the functions
into a case statement is an aggregate function that takes the 2 unit
types and then gives back
Sim Zacks wrote:
> According to the documentation, you can pass multiple parameters into an
> aggregate function, but it only stores one value.
>
>
> What I am trying to do is sum a quantity field, but it also has units
> that need to be converted.
Have you seen Martijn van Oosterhout's tagged t
> That could work in some cases, however in our case it would
> not produce
> desirable results.
Well I don't think you got Alban's suggestion right...
What he was trying to say was:
- use a regular (not aggregated) function to convert all measures to mm
- use the normal SUM() to sum those value
> It's probably easiest to decide on an internal unit to use in your
> aggregate and only convert it to the desired unit once you're done
> summing them. I'd probably convert all measurements to mm in the
> function and summarise those.
That could work in some cases, however in our case it would no
On 13 Aug 2009, at 12:51, Sim Zacks wrote:
What I am trying to do is sum a quantity field, but it also has units
that need to be converted.
4 meter
400 mm
100 cm
I want to sum it all, my function decides to use meter (based on the
requirements) and should return 4.00104 (or something like
11 matches
Mail list logo