Subject | Re: [firebird-support] Error after migrating from 1.5 to 2.0 (SubString) |
---|---|
Author | Svein Erling Tysvaer |
Post date | 2007-01-30T07:53:22Z |
SUM applies to something numeric, whereas substring applies to some kind
of text, doing SUM on a CHAR(2) field doesn't make sense. So - assuming
that you want to sum the numeric equivalent of some part of some text -
change to something like:
select tipotributo, produto,
sum(cast(SUBSTRING(quantidade from 1 for 2) as Integer)),
sum(valorunitario) from itensvenda
where tipotributo = '1'
group by tipotributo, produto
order by 3 desc
HTH,
Set
Anderson - EasyBit wrote:
of text, doing SUM on a CHAR(2) field doesn't make sense. So - assuming
that you want to sum the numeric equivalent of some part of some text -
change to something like:
select tipotributo, produto,
sum(cast(SUBSTRING(quantidade from 1 for 2) as Integer)),
sum(valorunitario) from itensvenda
where tipotributo = '1'
group by tipotributo, produto
order by 3 desc
HTH,
Set
Anderson - EasyBit wrote:
> Hi,
>
> A friend has migrated from 1.5 and the following SQL sentence report
> the "expression evaluation not supported" error. He said that In
> v1.5 the same SQL worked fine. Someone have any idea on how to solve this?
>
> select tipotributo, produto, sum(SUBSTRING(quantidade from 1 for 2)) ,
> sum(valorunitario) from itensvenda
> where tipotributo = '1'
> group by tipotributo, produto
> order by sum(SUBSTRING(quantidade from 1 for 2)) desc
>
>
> Thanks,
>
> Anderson