Print Page | Close Window

Command reference

Printed From: Crystal Reports Book
Category: Crystal Reports 9 through 2022
Forum Name: Data Connectivity
Forum Discription: How to connect to data sources and export reports
URL: http://www.crystalreportsbook.com/forum/forum_posts.asp?TID=958
Printed Date: 11 Apr 2025 at 9:41am


Topic: Command reference
Posted By: dragos78
Subject: Command reference
Date 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.



Replies:
Posted By: dragos78
Date 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?


Posted By: BrianBischof
Date 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>



Print Page | Close Window