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

Display records from 2 tables based on parameters...

Status
Not open for further replies.

ProgressiveJL

IS-IT--Management
Jul 5, 2006
46
CA
I have two tables that I'd like to pull all data from which meet my parameter field criteria. So far I've tried linking the tables via the "account" field but no data is listed in the details section. My parameters are starting date, ending date, and account number.

I'd like to list records from both tables based on the parameters.

Thanks!
 
What version of Crystal, and what database?

One way you might do this is by using a Add Command (started in version 9), and use a UNION ALL query, as in:

select fld1, fld2 from, table1
where fld4 = {?parameter}
UNION ALL
select fld1, fld2 from, table1
where fld4 = {?parameter}

Note that you create parameters in the SQL build window.

You'll see Add Command under your database connection (depending on the type).

-k
 
I'm using XI, and an xBase database.

I'll give this a shot... Seems to make sense but I didn't know there was an SQL build window... hehe.. thanks!
 
I think if you use an ODBC connection it might allow for it.

If it's an xBase, you should be able to just combine the rows in xBase.

Create another table and use INSERT into or whatever the syntax was from both tables (use to do xBase years ago).

-k
 
OK.. so I was able to get the records from both tables to display based on my parameter fields by linking them by account number.. (I wasn't testing with a valid account # hehe)

So here's my next situation. I've place the fields in the details section but since the tables are joined, field data from Table1 displays data from Table2 regardless... and vice versa.

What I want to happen is to list all records in Table1 and Table2 that meet my parameter values. What's happening now is that records from both tables are printing out twice. ie. data is printing out for the Table1 occurence and then again for Table2 occurence.

Hope that makes sense.
Thanks again for the input!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top