Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SQL Expression Editor

Status
Not open for further replies.

madaw

Programmer
Nov 3, 2002
2
CA
I'm new to crystal reports and I'm having problems with the syntax of the SQL Expression Editor. I using 3 tables. The main table(A) has most of the info that I want to display. Table(B) and Table(C) both have amounts I want to display on the detail line based on the unique id from Table(A). The extra twist is that in both Table(B) and Table(C) I have to display the amounts based on certain criteria from the tables. It seems like the SQL Editor is the way to go but I'm getting errors on the syntax.

Here's my code:
SELECT
TableA.`codnum`,
TableB.`number`,
TableB.`category`,
TableB.`amount`
FROM
`TableA` TableA,
`TableB` TableB
WHERE
TableA.`codnum` = TableB.`number`
AND TableB.`category` = "CA"

I'm using Crystal Reports 8.5 and it's a Foxpro database.

Thanks.
 
SQL Expressions are simply native database functions. Please review the following FAQ for more info: faq767-1377.
 
What you want is the record selection criteria once you've placed the tables in the report.

Report->Edit Selection Formula->Record

So for something like:

"The extra twist is that in both Table(B) and Table(C) I have to display the amounts based on certain criteria from the tables."

If you wanted to limit the rows to Category = 1, use something like:

TableB.Category = 1
and
TableC.Category = 1

-k kai@informeddatadecisions.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top