Board index » delphi » SQL & Calculated Fields

SQL & Calculated Fields

Can anyone give me an example on defining a calculated field with local sql
that can be used on a TQuery. For example if I have a field named price and
another field named quantity, how can I define a calculated field named
total (price * quantity) at SQL level (I know It can be done as I've seen
it somewhere before).

Thanks In Advance

Kok Wooi

KeyQuotes Services Sdn Bhd.

 

Re:SQL & Calculated Fields


KeyQuotes Services Sdn Bhd wrote:

Quote
> Can anyone give me an example on defining a calculated field with
> local sql
> that can be used on a TQuery. For example if I have a field named
> price and
> another field named quantity, how can I define a calculated field
> named
> total (price * quantity) at SQL level (I know It can be done as I've
> seen
> it somewhere before).

> Thanks In Advance

> Kok Wooi

> KeyQuotes Services Sdn Bhd.

   You make, for exemple, this SQL Statement:

Select cod_fornec, desc_fornec, (price * quantity)
From Table_name
Where ...

It results a view with 3 columns: Code, Description and Total

Eduardo Bortoluzzi
PUCRS
Brazil

Other Threads