In This Chapter
Creating an SQL expression field
Adding an SQL statement to a repository
Modifying an SQL field
Crystal Reports 2008 has a feature called SQL Commands. SQL is an internationally accepted standard language for dealing with relational databases. Report writers, such as Crystal Reports, retrieve data from such databases. They do so by translating the data retrieval part of the report into an SQL statement that's sent to the database. The database management system (DBMS) executes the SQL statement on the data in the database, and then sends the result set back to the report writer, which formats and displays it.
As you may know, some concepts that you can express in one language are impossible to translate accurately into another language. I ran into this problem while trying to communicate with a taxi driver in Beijing, China, using my community college Mandarin. I ended up on the wrong side of town, late at night. A similar problem can happen with database reports.
Even though Crystal Reports provides handy wizards and dialog boxes, you might have a hard time zeroing in on a particular data set. You might, however, be able to get what you want by speaking the database's native language, SQL. SQL isn't a particularly easy language to learn. (Hint: SQL For Dummies [Wiley], by yours truly, can make it about as easy as possible.) If you make the effort to learn SQL, you can extend the power of Crystal Reports. And when using the SQL Commands ...