Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Creating SQL Expressions Post Reply Post New Topic
Author Message
Keikoku
Senior Member
Senior Member


Joined: 01 Dec 2010
Online Status: Offline
Posts: 386
Quote Keikoku Replybullet Topic: Creating SQL Expressions
     Posted: 17 Jan 2011 at 5:09am
I've always used Commands when querying the DB, but I figured I should look into SQL expressions for some flexibility.

So I connected to a table TEST that has only two columns: Number, Letter. ie:

1 A
2 B
3 C
4 D

So then I wanted to display all of the letters whose associated number < 10
But am not sure how to do so.

Searched around, but all of the examples I've seen were Commands.

Edited by Keikoku - 17 Jan 2011 at 5:13am
IP IP Logged
hilfy
Admin Group
Admin Group
Avatar

Joined: 20 Nov 2006
Online Status: Offline
Posts: 3702
Quote hilfy Replybullet Posted: 18 Jan 2011 at 8:14am
That's not what SQL Expressions are used for. 
 
When you connect Crystal directly to tables instead of to a command, you can use SQL expressions to do things like calling database functions using one or more fields.  These then become part of the Select statement that Crystal generates to get the data.  I've used them in a couple of different ways - for example, to truncate the time off of a datetime field or to call a custom function that returns a name based on an ID.
 
SQL Expressions can't replace commands, but they provide some of the power of commands to users who can't/don't want to develop their own SQL commands in Crystal.
 
-Dell
IP IP Logged
Keikoku
Senior Member
Senior Member


Joined: 01 Dec 2010
Online Status: Offline
Posts: 386
Quote Keikoku Replybullet Posted: 19 Jan 2011 at 5:32am
So if I have no problem using Commands I most likely don't need to deal with SQL expressions?
IP IP Logged
hilfy
Admin Group
Admin Group
Avatar

Joined: 20 Nov 2006
Online Status: Offline
Posts: 3702
Quote hilfy Replybullet Posted: 19 Jan 2011 at 7:08am
Exactly! Wink
IP IP Logged
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum