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

What select statement would best be used?

Status
Not open for further replies.

BlurredVision

Technical User
Aug 6, 2001
326
GB
I can't run this select statement at this time, but what do you think would run faster, A or B, also, I am always open to sugguestions.

TY. Brian


Select Statement (A)

not ({evt_pat_ah.EVENT_CD} startswith ["PI", "VA", "VI"]) and
{evt_pat_ah.DTREF_RM} = {?Begin Date} to {?End Date} and
({evt_pat_ah.UNIT}) <> '' and
Not({evt_pat_ah.UNIT} startswith ["R", "U"])

OR

Select Statement (B)

not ({evt_pat_ah.EVENT_CD} startswith ["PI", "VA", "VI"]) and
{evt_pat_ah.DTREF_RM} = {?Begin Date} to {?End Date} and
({evt_pat_ah.UNIT}) <> '' and
Not({evt_pat_ah.UNIT} startswith ["R", "U"])
 
Sorry about that..

Here is select (B)


not ({evt_pat_ah.EVENT_CD} like ["PI*", "VA*", "VI*"]) and
{evt_pat_ah.DTREF_RM} in {?Begin Date} to {?End Date} and
Not IsNull ({evt_pat_ah.UNIT}) and
Not({evt_pat_ah.UNIT} like ["R*", "U*"])
 
Performance should be the same. I ran a simple report against the Xtreme Product Table. Not Startswith and Not Like both generated the same WHERE clause in Show SQL Query:
Code:
SELECT
    Product.`Product ID`, Product.`Product Name`, Product.`Color`
FROM
    `Product` Product
WHERE
    Product.`Color` NOT LIKE 'St%'


~Kurt
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top