SQL statement for derived field

Jeff31592

Registered User.
Local time
Today, 03:58
Joined
Jun 7, 2012
Messages
26
I am struggling with the proper syntax to use in SQL statement that includes derived field. Consider:

dim strValue as double

dim strSQL as string

dimstrSQL = "Select abc, def, ghi, (Price * strValue) AS Extended From CustInvoice

in this example we are querying the table CustInvoice and trying to get a new value "Extended" that would correspond to "Price" times a variable representing a discount.

thanks.
 
You need to use the variable itself, not just the letters that make up the variable. This means ending your quotes, putting the variable's value in there and then starting your quotes again:


dimstrSQL = "Select abc, def, ghi, (Price * " & strValue & ") AS Extended From CustInvoice;"
 
thanks that worked.

the one combination of quote marks, ampersand, and apostrophes I didn't use
 

Users who are viewing this thread

Back
Top Bottom