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

Left Outer Join

Status
Not open for further replies.

NiceArms

Programmer
May 21, 2009
105
GB
I have 4 tables:
1. Account
2. Customer
3. Sundry
4. Transactions

Account to Customer = Inner join
Account to Sundry = Inner Join
Account to Transactions = Left Outer

I am trying to return data from the Account table whether the {Transactions.tran-code} = 'SC3000' or not.

I think I have found the source of the issue as per below but I don't know how to fix it.

Selection Criteria:
Code:
{Account.client-code} = {?Code}
and {Account.dt-datinstr} in {?Date_range} 
and {Customer.dr-rectype} in 'D'
and split({sundry.si-logical},";")[12] = "0"
and ({Transactions.tran-code} = 'SC3000')
Now I know that:
Code:
and ({Transactions.tran-code} = 'SC3000')

Causes the Left Outer Join to act like an Inner Join. Which is what is causing nothing to return

I know the solution to this is SQL is to place:
Code:
and ({Transactions.tran-code} = 'SC3000')

Into the FROM statement not the WHERE statement but Crystal 9 does not allow me to edit the SQL statement.

How do i get round this issue?

/Nice
 
Change

and ({Transactions.tran-code} = 'SC3000')

to

and (isnull({Transactions.tran-code}) or {Transactions.tran-code} = 'SC3000')

Ian


 
You can CREATE the SQL in v.9 by using a command as your datasource (database expert->your datasource->add command (above the table list)), and then you will be able to add the criterion in the FROM clause and still maintain the left outer join.

Otherwise, you cannot add criteria--even with an isnull clause--since you would lose some records where the transaction exists (not null and not the desired code). You would then test for the presence of the code in a formula within the report.

-LB
 
Thank you both for your input :D

I have gone with lbass's suggestion.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top