This topic is locked

Add Calculated Fields

5/3/2007 9:26:02 AM
PHPRunner General questions
K
kwhite75 author

I have 2 tables with the following SQL statements:
_WorkOrder
select `ID`,

`WOID`,

`CustomerName`,

`Hours`,

`Rate`,

`Material`,

RateHours as LaborTotal,

Material
0.05 as Tax,

`WorkDone`

From `_WorkOrder`
_Invoice
select `InvoiceID` ,

_WorkOrder.CustomerName,

_WorkOrder.Hours,

_WorkOrder.Rate,

_WorkOrder.Material,

_WorkOrder.WorkDone

From `_Invoice`

inner join _WorkOrder on _Invoice.WOID=_Invoice.WOID
I am trying to get a total in the invoice table for basically LaborTotal+Material+Tax as InvoiceTotal
LaborTotal and Tax are both calculated fields in the table _WorkOrder. How do I add them together?
kw

Alexey admin 5/4/2007

Hi,
here is the query you need:

select `InvoiceID` ,

_WorkOrder.CustomerName,

_WorkOrder.Hours,

_WorkOrder.Rate,

_WorkOrder.Material,

_WorkOrder.WorkDone,

_WorkOrder.Rate_WorkOrder.Hours + _WorkOrder.Material + _WorkOrder.Material0.05 as InvoiceTotal

From `_Invoice`

inner join _WorkOrder on _Invoice.WOID=_Invoice.WOID