Home » SQL & PL/SQL » SQL & PL/SQL » SQL Logic (11.2.0.2.0 - 64 bit Production)
SQL Logic [message #584385] Mon, 13 May 2013 09:04 Go to next message
sulabhagra
Messages: 57
Registered: April 2012
Member
Hello,

I have a SQL logic for which I am trying to work on .

I have 2 user tables, one at Customer level and another at account level linked on customer id's. System1 has an attribute say A1 which also exists in system2. But, the System1 has ony 1 value against a customer, and system2 has multiple values against a customer, one for each account, e.g. for Cust1 we have the value for A1 as 1001 and Acc1 has 1001, Acc2 has 1004 and Acc3 has 1001 again.

Now, I need to compute metrics to show where (summary counts) the accounts attribute A1 does not match with the customer attribute and also the counts of Customers where atleast one of the customer account has a matching attribute value with the Customer and also count of those Customers where there are multiple accounts and none of them have a matching attribute with the attribute value of the customer.

Customer A1 Account A1
X1 1001 ASD1 1001
X1 1001 ASD2 1002
X2 1234 AWD1 1223
X2 1234 AWD2 1221
X2 1234 AWD3 1220
X3 1456 WED1 1567

So, we need the counts for these metrics.

Tot customer|Having Single Acc| having Multiple Acc|Multiple Attr Val|Multiple Attr Val with atleast one Match



Thanks in advance,
Re: SQL Logic [message #584388 is a reply to message #584385] Mon, 13 May 2013 09:14 Go to previous messageGo to next message
Michel Cadot
Messages: 59088
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
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.

Before, Please read OraFAQ Forum Guide and How to use [code] tags and make your code easier to read.
Make sure that lines of code do not exceed 80 characters when you format.
Indent the code, use code tags and align the columns in result.
Use the "Preview Message" or "Preview Quick Reply" button to verify.

Regards
Michel
Re: SQL Logic [message #584408 is a reply to message #584388] Tue, 14 May 2013 01:49 Go to previous message
rajiv.v
Messages: 16
Registered: February 2013
Location: Bangalore
Junior Member
I feel by using a group by cust account and using a join condition on the common table the required results can be achieved,but as Michel says a query which you have tried and the respective output and output what you need can be pasted rather than just telling scenario.
Previous Topic: Error in Execute Immediate
Next Topic: convert time part into second
Goto Forum:
  


Current Time: Wed Sep 17 00:59:43 CDT 2014

Total time taken to generate the page: 0.07110 seconds