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

Left Join with condition

Status
Not open for further replies.

pkohli88

Programmer
Oct 25, 2006
30
US
Hi,
is it a way to join a main table to secondary table.
like this without using command
Code:
select
*
from table_A A
left join table_B B on A.field1 = B.Field1 where B.field2 = 'ABC'

so my objective is to get all records from table A and I want to show only those fields from table B where B.Field2 ='ABC' rest will be shown as null.

Thanks


I am using crystal version 10 and oacle 10g as a database


 
Below your data source you'll see Add Command, you can paste SQL in there as the data source.

This started in CR 9.

-k
 
I can't use COMMAND option because I am using multivalue parameters in the record selection formula

any other way....besides using Command
 
Normally Crystal won't let you have a left-outer join from A to B and also do a selection on B. If you do a selection on B, then A's without a B get excluded.

What are you trying to do? You may need to select records you don't need and then do a test to exclude them from the display, e.g.
Code:
 if not IsNull (B.Field1)
and {B.field2} = 'ABC'
then "Found"
else "Not"

[yinyang] Madawc Williams (East Anglia, UK). Using Windows XP & Crystal 10 [yinyang]
 
If you can't use a command, you can remove the condition from the record selection formula and apply it (in reverse) to the section suppression expression:
NOT(IsNull(B.field2) OR B.field2 = 'ABC')

Note: perhaps you can achieve the same thing by using the Group Selection formula. Worth a try...

- Ido

view, e-mail, export, burst, distribute, and schedule Crystal Reports.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top