AnsweredAssumed Answered

Help with an SQL statement

Question asked by user22862 on Jul 16, 2016
Latest reply on Jul 17, 2016 by CICT

Hey Guys,

 

I have not practiced SQL, pretty much at all, past one or two brief walk throughs, and I'm having difficulty with what I feel is likely a very simple one.

 

Goal is to provide a field that gives the total amount of labor on an invoice.

 

Invoices have a number of invoice line items. If the item is labor, the record has a 1 in the field "isLabor". Otherwise its blank.

 

Here is what I have evolved my attempt into, but still getting the unwelcome "?" in the result.

 

ExecuteSQL ( 

 

 

"

SELECT SUM ExtendedPrice

FROM INL_Invoices_Line_Items

WHERE id_invoice = ?

isLabor = ?

"

;"" ; ID_Invoice ; 1 )

 

 

####    Table Names:

 

INL_Invoices_Line_Items

INV_Invoices

 

Primary Key in Invoices is: ID_Invoice

foreign Key in INL_Invoice_Line_Items is: id_invoice

Outcomes