Data Connectivity
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Data Connectivity
Message Icon Topic: Command reference Post Reply Post New Topic
Author Message
dragos78
Newbie
Newbie


Joined: 03 Jul 2007
Location: Romania
Online Status: Offline
Posts: 4
Quote dragos78 Replybullet Topic: Command reference
    Posted: 03 Jul 2007 at 6:36am
Hello,
 
I have a question about select with SQL.
I have the following problem. I want to make 3 commands named: dd1, dd2, dd3.
 
dd1:
 
select f1,f2,f3,f4,f5 from table1
 
dd2:
 
select a1,a2,a3,a4 from table2
where a1=f1.table1
 
dd3:
 
select a1,a2,a3,a4 from table2
where a1=f2.table1
 
dd1 is the main select statement and I need to select twice from the same table but with different conditions. Can this be done? Can I reference a field from dd1 command in dd2 and dd3?
 
Thanks.


Edited by dragos78 - 03 Jul 2007 at 6:38am
IP IP Logged
dragos78
Newbie
Newbie


Joined: 03 Jul 2007
Location: Romania
Online Status: Offline
Posts: 4
Quote dragos78 Replybullet Posted: 03 Jul 2007 at 8:30am
On my way back home I realized that I can do this without making 3 commands.
By joining 2 tables in one sql command, ordernig and grouping I can obtain the result I want.

The question remains:
Can I make a reference in dd2 at a column from dd1?
IP IP Logged
BrianBischof
Admin Group
Admin Group
Avatar

Joined: 09 Nov 2006
Online Status: Offline
Posts: 2458
Quote BrianBischof Replybullet Posted: 03 Jul 2007 at 9:53am
If you join two tables together, your SELECT statement can reference any field from either table. As long as the table is referenced somewhere in the SELECT statement then you can use it's data.
Please support the forum! Tell others by linking to it on your blog or website:<a href="http://www.crystalreportsbook.com/forum/">Crystal Reports Forum</a>
IP IP Logged
Post Reply Post New Topic
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



This page was generated in 0.031 seconds.