Need assistance again with ( ) Parentheses. Not pulling back exactly what I am looking for, getting extra stuff.

Need assistance again with ( ) Parentheses.


WHERE            
AP.SERV_DATE BETWEEN '01/01/2017' AND '01/31/2017'
AND ap.status_c = '4'  
AND ((PX1.POS_TYPE_C IN ('11','15','17','49','50','71','72')  

AND eap1.proc_code IN ('90901','90911','92506','92507','92521','92522','92523','92524','92526','92601','92602','92603','92604','92605','92606','92607','92609','92610','92611','92612','92614','92616',' 95831','95832','95833','95834','95851','95852','96105','97001','97002','97003','97004','97005','97006','97010','97012','97014','97016','97018','97022','97024','97026','97028','97032','97033','97034',' 97035','97036','97039','97110','97112','97113','97116','97124','97139','97140','97161','97162','97163','97164','97165','97166','97167','97168','97530','97532','97533','97535','97537','97542','97545','97750','97755','97760','97761','97762','97799','0019T','0101T','0102T'))

I am getting the needed Proc_codes but POS_TYPE_C i am  picking up 11, 12, 27, so picking up stuff not in my criteria.  I am also picking up some 2016 dates in my date range.

Basically want to pull back any PRoc_codes with a POS_TYPE_C of 11, 15,17,49,50,71 and 72 in the date range listed
Culwatrnca11Data AnalystAsked:
Who is Participating?
 
mlmccCommented:
() are not the problem.  All the logical operators are AND so the order of operation doesn't matter.

Did you cut and paste the filter?

mlmcc
1
 
Culwatrnca11Data AnalystAuthor Commented:
no
0
 
mlmccCommented:
The one you posted should work.

Can you copy it out of the SQL and post it here?

mlmcc
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.