Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Order in where clause - SQL statement

Former Member
0 Likes
501

Hi,

The order of the fields in Where clause in OpenSQL statements is important to get the right index?

Select a b c from t1

where

d = p_d and

e = p_e

Or

Select a b c from t1

where

e = p_e and

d = p_d

Index:

columns e and d.

Thanks !

4 REPLIES 4
Read only

Former Member
0 Likes
478

HI,

Both will give you the same result.. but it is always good to pass the sequence as in the table.. the performance will be good when you follow the sequece of occurance of the fields.

Thanks

Mahesh

Read only

Former Member
0 Likes
478

It should be better to provide the fields for the WHERE statement in order...That way the table can be accessed faster.

Greetings,

Blag.

Read only

Former Member
0 Likes
478

This is a duplicate post - please check my answer in the other one.

Rob

Read only

Former Member
0 Likes
478

Thank you!!