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

where Conditionals in Database expert

Status
Not open for further replies.

lthomas6

MIS
Aug 22, 2007
87
US
I am trying to to see if the database expert in Crystal has a way where I can put my where conditionals in it instead of the select expert.

The issue I am facing is that since I have 8 reports in the report where 5 of them are the same table but with different aliases, it is causing an implicit Inner join.

I have tried altering the select expert to say the following, but no luck.
ie:
(Isnull({BU.UserFieldProfile_ID}) OR {BU.UserFieldProfile_ID} = 10052)
And
(Isnull({lrec.UserFieldProfile_ID}) OR {lrec.UserFieldProfile_ID} = 10023)
 
Please describe the what you are trying to achieve in terms of the data set returned. If you left join tables, but then add a selection criterion on the right hand table, it will effectively undo the left join. You can either remove the selection criteria and use the criteria in conditional formulas in the body of the report to return desired fields, or you can use the "add command" feature (above the tables in the database expert), and write a command to use as your sole datasource, where you add the criteria in the "From" clause instead of the "Where clause"

e.g.,

Select table.field
From table
left join table_1 on
table.key = table_1.key and
table_1.ID = 10052
)
left join table_2 on
table.key = table_2.key and
table_2.ID = 10023
)

This would preserve the left joins.

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top