Avatar of David Bass
David Bass
 asked on

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!
Oracle DatabaseSQL

Avatar of undefined
Last Comment
slightwv (䄆 Netminder)

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
johnsone

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
David Bass

ASKER
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
jsaun

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.
David Bass

ASKER
Thank you!
Your help has saved me hundreds of hours of internet surfing.
fblack61
jsaun

Are you trying to AND or OR the conditions together?
slightwv (䄆 Netminder)

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

johnsone

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.
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
slightwv (䄆 Netminder)

>>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.