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

ASE query where filter priority order

0 Likes
908
  • SAP Managed Tags

Dear experts,

I want to know on which priority order filters were applied in a query.

Let's say a query with 4 conditions in where clause. In which order these were processed.

Is it, first filter rows using 1st condition col1 = value1, on this result set apply 2nd filter and so on...

select column1, column2 from my_table where col1 = value1 and col2 = value2 and col3 = value 3 and col4 = value4

Dear experts,

I want to know on which priority order filters were applied in a query.

Let's say a query with 4 conditions in where clause. In which order these were processed.

Is it, first filter rows using 1st condition col1 = value1, on this result set apply 2nd filter and so on...

select column1, column2 from my_table where col1 = value1 and col2 = value2 and col3 = value 3 and col4 = value4

1 REPLY 1
Read only

Former Member
0 Likes
818
  • SAP Managed Tags

Hi Naveen,

SQL optimizer decides which condition retrive least number of records. Accordingly, it decides the order of filters to be processed. If you want enforce the order of execution of filters then you can use sub query of use filters within brackets.