How can I get multiple results with the where clause. In Oracle SQL

In Oracle SQL how could I do create this Query.  I would like to check for multiple conditions with the where clause.

select * from lawprod.WHSHIPLINE where company=10 location=98MDC update-date='01/20/2018'

It works if I do this

select * from lawprod.WHSHIPLINE where company=10  

However, I would like to check for more conditions like

I would like to include data of the company=10 and location=98MDC and update_date = 01/20/2018

Thanks for any help!
David BassAsked:
Who is Participating?
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.

johnsoneSenior Oracle DBACommented:
Not sure I understand what you are looking for, so try this:
SELECT * 
FROM   lawprod.whshipline 
WHERE  company = 10 
       AND EXISTS (SELECT NULL 
                   FROM   lawprod.whshipline 
                   WHERE  company = 10 
                          AND location = '98MDC' 
                          AND update_date = To_date('01/20/2018', 'mm/dd/yyyy')) 
; 

Open in new window

If that doesn't work, please provide sample data and expected results.
0

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
David BassAuthor Commented:
Hi, I tried that and I have this syntax error

ORA-00907: missing right parenthesis
00907. 00000 -  "missing right parenthesis"
*Cause:    
*Action:
Error at Line: 11 Column: 48
0
jsaunCommented:
There are 4 parens in his solution.  Make sure you copy/paste them all.  If possible, use a visual editor that matches parens and highlights syntax.
0
Big Business Goals? Which KPIs Will Help You

The most successful MSPs rely on metrics – known as key performance indicators (KPIs) – for making informed decisions that help their businesses thrive, rather than just survive. This eBook provides an overview of the most important KPIs used by top MSPs.

David BassAuthor Commented:
Thank you!
0
jsaunCommented:
Are you trying to AND or OR the conditions together?
0
slightwv (䄆 Netminder) Commented:
I'm late to the party but I'm not sure they need the inner select and hitting the table twice:
SELECT * 
FROM   lawprod.whshipline 
WHERE  company = 10 AND location = '98MDC' AND update_date = To_date('01/20/2018', 'mm/dd/yyyy')) 
; 

Open in new window

0
johnsoneSenior Oracle DBACommented:
slightwv, I read the requirement differently and the inner select would be needed.  I read it as you want all of company 10 if the other conditions are met by at least one record.  Not sure you can do that without the inner select and yours seems to only give the records that satisfy all 3 conditions.  Not all the records that satisfy the first condition if there is one record that satisfies all 3.
0
slightwv (䄆 Netminder) Commented:
>>I read it as you want all of company 10 if the other conditions are met by at least one record.

I can see it that way.
1
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
SQL

From novice to tech pro — start learning today.