Home » SQL & PL/SQL » SQL & PL/SQL » Need data from table but there is multiple conditions (oracle 11g)
Need data from table but there is multiple conditions [message #628488] Tue, 25 November 2014 12:01 Go to next message
deepak416
Messages: 63
Registered: January 2013
Location: Pune
Member
id name qty mqty branch
1 PEN 3 21 A
1 PEN 4 21 B
1 PEN 13 21 C
2 PENCIL 2 3 A
2 PENCIL 1 3 B
2 PENCIL 1 3 C


There is two type of stock one is PEN and another is PENCIL with qty and min qty, the stock in differ differ branch, i need those row which has less quantity from its minimum qty.

Take an example: There is one stock PEN which has 20 qty but min qty is 21 and PENCIL has 4 qty but its min qty is 3 i need this row in result.

Re: Need data from table but there is multiple conditions [message #628489 is a reply to message #628488] Tue, 25 November 2014 12:02 Go to previous messageGo to next message
BlackSwan
Messages: 26766
Registered: January 2009
Location: SoCal
Senior Member
Please read and follow the forum guidelines, to enable us to help you:

http://www.orafaq.com/forum/t/88153/0/ and read http://www.orafaq.com/forum/t/174502/
Re: Need data from table but there is multiple conditions [message #628491 is a reply to message #628489] Tue, 25 November 2014 12:06 Go to previous messageGo to next message
deepak416
Messages: 63
Registered: January 2013
Location: Pune
Member
id############name##########qty#########mqty#######branch
1*************PEN*********** 3**********21*********A
1*************PEN************4**********21*********B
1*************[/b]PEN[/b]**********13*********21*********C
2*************PENCIL*********2**********3**********A
2*************PENCIL*********1**********3**********B
2*************PENCIL*********1**********3**********C


There is two type of stock one is PEN and another is PENCIL with qty and min qty, the stock in differ differ branch, i need those row which has less quantity from its minimum qty.

Take an example: There is one stock PEN which has 20 qty but min qty is 21 and PENCIL has 4 qty but its min qty is 3 i need this row in result.

[Updated on: Tue, 25 November 2014 12:12]

Report message to a moderator

Re: Need data from table but there is multiple conditions [message #628492 is a reply to message #628491] Tue, 25 November 2014 12:07 Go to previous messageGo to next message
BlackSwan
Messages: 26766
Registered: January 2009
Location: SoCal
Senior Member
Please read and follow the forum guidelines, to enable us to help you:

http://www.orafaq.com/forum/t/88153/0/ and read http://www.orafaq.com/forum/t/174502/
Re: Need data from table but there is multiple conditions [message #628493 is a reply to message #628492] Tue, 25 November 2014 12:12 Go to previous messageGo to next message
deepak416
Messages: 63
Registered: January 2013
Location: Pune
Member
Swan updated msg
Re: Need data from table but there is multiple conditions [message #628495 is a reply to message #628488] Tue, 25 November 2014 12:16 Go to previous messageGo to next message
John Watson
Messages: 8931
Registered: January 2010
Location: Global Village
Senior Member
Is this a college homework assignment? If so, you need to correct the relational analysis: that table does not look normalized to me.
Re: Need data from table but there is multiple conditions [message #628498 is a reply to message #628495] Tue, 25 November 2014 12:32 Go to previous messageGo to next message
BlackSwan
Messages: 26766
Registered: January 2009
Location: SoCal
Senior Member
http://www.orafaq.com/forum/m/615333/#msg_615333

it appears at one point in time you knew how to use {code} tags.
Re: Need data from table but there is multiple conditions [message #628504 is a reply to message #628488] Tue, 25 November 2014 13:38 Go to previous message
Michel Cadot
Messages: 68645
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator

Please read OraFAQ Forum Guide and How to use [code] tags and make your code easier to read.
Also always post your Oracle version, with 4 decimals.

With any SQL or PL/SQL question, please, Post a working Test case: create table (including all constraints) and insert statements along with the result you want with these data then we will be able work with your table and data. Explain with words and sentences the rules that lead to this result.

Previous Topic: INSERT with SELECT ON DISTINCT
Next Topic: Update Statement with multiple joins
Goto Forum:
  


Current Time: Thu Apr 25 07:27:31 CDT 2024