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!

more efficient select expert formula?

Status
Not open for further replies.

patty1

Programmer
Apr 17, 2002
105
US
I have a very inefficient select expert formula - it takes way too long. This was the original query:

(({Transaction_History.Social_Code} = "047") or
({Transaction_History.Social_Code} = "075" and
{CONTACT.C_ADR_1} = "Fidelity Investment Advisor Group")) and not ({Rep_Profile.Territory} in ["85", "89", "90", "88", "00"] and
{Transaction_History.Fund} in "0100" to "0399")

then I had to add an "or" statement

or
({Transaction_History.Fund} = "647" and
{Transaction_History.Social_Code} ="057" and
{Transaction_History.Dealer_Number} = "3705" and
{Transaction_History.Account_No} in ["9083852112", "9083852211"])

this is what I ended up with:

(({Transaction_History.Social_Code} = "047") or
({Transaction_History.Social_Code} = "075" and
{CONTACT.C_ADR_1} = "Fidelity Investment Advisor Group"))

or

({Transaction_History.Fund} = "647" and
{Transaction_History.Social_Code} ="057" and
{Transaction_History.Dealer_Number} = "3705" and
{Transaction_History.Account_No} in ["9083852112", "9083852211"])
and
not ({Rep_Profile.Territory} in ["85", "89", "90", "88", "00"] and
{Transaction_History.Fund} in "0100" to "0399")

Once I added the "or" statement, the query slowed to a crawl. I am sure there is a better way of writing this.


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top