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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Link options

Status
Not open for further replies.

loRdK

IS-IT--Management
Sep 16, 2003
14
BR
I'm using Crystal Reports 4.6.1 with an ODBC database.

I need to use the option "Link options/Look up all of one, then all of other", but it's not available for ODBC databases.

Can anyone tell me how to reproduce that behaviour for an ODBC database?

Thanks.
 
I can't recall what that option does, but it sounds like the equivalent of a Union.

Go into the Database->Show SQL Query

Copy the existing query

Type the word Union at the end

Paste in the query and change the name of the table used to the second table.

Now you'll get all of the first table and all of the second table.

This would be better to create on the database as a View.

-k
 
Thanks, synapsevampire.

But the union query is not possible because the select statements I need have different number of columns.

Any other idea?
 
Add to the UNION part that has less columns dummy columns.

Cheers,
- Ido

CUT, Visual CUT, and DataLink Viewer:
view, e-mail, export, burst, distribute, and schedule Crystal Reports.
 
Ido, I have no dummy columns, the tables are really different.
 
Ido, I have no dummy columns, the tables are really different.
Thanks.
 
You're trying to link up these two tables, there must be some fields within each that you are interested in using. So just concern yourself with those fields.

Start with one of the tables and make a view with just those fields in it. The resulting SQL will look something like "Select field1, field2 from table1". Try it out and make sure it works. Now add the dummy fields to the view, such as "Select field1, field2, Null AS field3 from table1". When you test it now, you'll see that dummy field without any data in it. Add Union (or UNION ALL) at the end of the statement, and build the second query using the same fields and field names. It should now work.
 
Dummy columns are not actual columns in the table - they are just expressions that return a constant value.

By the way, the same technique is VERY useful in adding a column that differentiates between rows that were returned in the 1st part of the UNION and rows that were returned in the 2nd part (simply use a different constant in each part).

hth,
- Ido

CUT, Visual CUT, and DataLink Viewer:
view, e-mail, export, burst, distribute, and schedule Crystal Reports.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top