Home » SQL & PL/SQL » SQL & PL/SQL » SQL Query Scenario (Oracle 10g)
SQL Query Scenario [message #607178] Mon, 03 February 2014 08:23 Go to next message
vino06cse57
Messages: 131
Registered: July 2011
Location: chennai
Senior Member
Hi all

I have data like

Cust_id Acct_no Status Risk_id Bal

-----------------------------------------------
101 LN101101 Q Loss 100
101 LN101102 A Normal 500
101 LN101101 Q Sub-Standard 100
102 LN102102 A Normal 350
102 LN102100 A Normal 100
103 LN103100 Q Sub-Standard 200

Hi I have a scenario like if a Customer has more accounts and if one goes Sub-standard, then i have to take all the accts of the customer as Substandard.

From the above data

Total Balance of Bad Customer is 1000.


Kindly Help me on this

[sql]

Re: SQL Query Scenario [message #607179 is a reply to message #607178] Mon, 03 February 2014 08:25 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/
Re: SQL Query Scenario [message #607181 is a reply to message #607178] Mon, 03 February 2014 08:36 Go to previous messageGo to next message
Michel Cadot
Messages: 68641
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator

Quote:
Total Balance of Bad Customer is 1000.


What does this mean? Where does 1000 come from? Where does "Bad" come from?

Quote:
if a Customer has more accounts


More accounts than what?

Re: SQL Query Scenario [message #607183 is a reply to message #607181] Mon, 03 February 2014 08:50 Go to previous messageGo to next message
vino06cse57
Messages: 131
Registered: July 2011
Location: chennai
Senior Member
Dear Micheal

The 1000 comes from adding the balances of customer Cust_id (101,103)

accounts is A single customer has more loan accounts

Thanks
Vinoth
Re: SQL Query Scenario [message #607184 is a reply to message #607183] Mon, 03 February 2014 08:55 Go to previous messageGo to next message
BlackSwan
Messages: 26766
Registered: January 2009
Location: SoCal
Senior Member
>The 1000 comes from adding the balances of customer Cust_id (101,103)
100+500+100+200 = 900; not 1000!
or am I missing something that you know & I don't?
Re: SQL Query Scenario [message #607185 is a reply to message #607183] Mon, 03 February 2014 08:56 Go to previous message
Michel Cadot
Messages: 68641
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator

Quote:
The 1000 comes from adding the balances of customer Cust_id (101,103)


How?
How 101 (with multiple accounts) is related to 103 (with a single account)?

Quote:
accounts is A single customer has more loan accounts


???
Explain in details each line of your table rows.
Explain in details your output (I still don't know what it should be).
Explain in details 1000, how do you compute it?
And post a test case.

Previous Topic: datatype
Next Topic: How to send mail from an Oracle database?
Goto Forum:
  


Current Time: Fri Apr 19 19:19:01 CDT 2024