Using Crystal Reports XI Developer;
Using MS SQL Server 2000;
public static void Main()
{
Having trouble figuring out the syntax for writing SQL Expression Fields in the Formula Workshop. My main problem is I can't find any examples anywhere to see how one actually works. Anyway, I've checked my query on the actual SQL engine using the Query Analyzer and it works just fine there.
My specific query looks like this:
SELECT AVG(answer)
FROM tercon.dbo.tbl_questionnai
re_logins,
tercon.dbo.tbl_questionnai
re_answers
WHERE teamid IN (257, 258, 259)
Using the SQL statement above and clicking on the check button (in Crystals' Fomula Workshop) I get the following error:
Error in Compiling SQL Expression:
Failed to retreive data from the database.
Details: ADO Error Code: 0x80040e14
Source: Microsoft OLE DB Provider for SQL Server
Description: Incorrect syntax near the keywork 'SELECT'
SQL State" 42000
Native Error: 156 [Database Vendor Code 156 ].
I've tried all sorts of stuff. Taking off the AVG() and just running it with "answer" in the SELECT portion. I've tried putting parenthesis around each of the database, table and column names like Crystal does when you view Database >> Show SQL Query. Example
SELECT "tercon"."dbo"."tbl_questi
onnaire_an
swers"."an
swer"
FROM "tercon"."dbo"."tbl_questi
onnaire_an
swers"
And I get the same error. I don't know where I'm going wrong. Any Ideas?
}
Start Free Trial