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!

Change SQL data link from "AND" to "OR" 2

Status
Not open for further replies.

piovesan

Technical User
Jan 23, 2002
159
CA
Hi! I am using Crystal Reports 11.5 and I have created a query using the Database Expert where I have joined a number of tables. It seems when you join more than one table to one other table using the expert, it automatically joins then with an "AND" statement.... such as:
LEFT OUTER JOIN "PID_DIST" "PID_DIST" ON ("LND_PARCEL"."PID"="PID_DIST"."PID") AND ("LND_PARCEL_MODIFIED"."PID"="PID_DIST"."PID")

I would like to change that AND to an OR........ I can view the SQL under the menu Database - Show SQL Query but I can't seem to edit in here.... is there a way to either edit that SQL, or do something using the database expert to do this??
Thanks in advance!!
 
You should be using the "Add command" feature in the database expert, above the list of tables for your datasource. You can copy the current SQL query into the command area of a new report, adjust the criteria, and then use that as the sole datasource for your report.

-LB
 
Thank you lbass! Is that the only way to do this? I have used the commands before but I had hoped I wouldn't have to.....
 
What is your reluctance? I find commands to be more efficient overall.

-LB
 
Well, it wasn't really my reluctance... I do these reports rarely so when I needed help from our developer on another report that I used a command for, she stated that she hated commands.... so I thought it would make it easier to get internal help if I just didn't use them.... but I will.... If it's the only way to have this kind of control.
Thank you for your help!!
 
I just looked at this more carefully, and you appear to want to link two different tables TO the same table, which you can't really do, so instead I think you should add the PID_DIST table twice, once with an alias, linking one to the Land_Parcel table and one to the land_parcel_modified table, both with left outer joins.

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top