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?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

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

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
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
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Crystal Reports

From novice to tech pro — start learning today.