Can do us a query to get the same results of 3 tables
CREATE TABLE TABLE1 (NODEID VARCHAR2 (4));CREATE TABLE TABLE2 (NODEID VARCHAR2 (4));
CREATE TABLE TABLE3 (NODEID VARCHAR2 (4));
INSERT INTO TABLE1 VALUE('1004');
INSERT INTO TABLE1 VALUE('1004');
INSERT INTO TABLE1 VALUE('1002');
INSERT INTO TABLE1 VALUE('1002');
INSERT INTO TABLE1 VALUE('1001');
INSERT INTO TABLE1 VALUE('1001');
INSERT INTO TABLE1 VALUE('1006');
INSERT INTO TABLE1 VALUE('1006');
INSERT INTO TABLE1 VALUE('1005');
INSERT INTO TABLE1 VALUE('1005');
INSERT INTO TABLE2 VALUE('1004');
INSERT INTO TABLE2 VALUE('1004');
INSERT INTO TABLE2 VALUE('1004');
INSERT INTO TABLE2 VALUE('1002');
INSERT INTO TABLE2 VALUE('1002');
INSERT INTO TABLE2 VALUE('1002');
INSERT INTO TABLE2 VALUE('1002');
INSERT INTO TABLE 3 VALUE('1001');
INSERT INTO TABLE 3 VALUE('1001');
INSERT INTO TABLE 3 VALUE('1006');
INSERT INTO TABLE 3 VALUE('1006');
INSERT INTO TABLE 3 VALUE('1005');
INSERT INTO TABLE 3 VALUE('1005');
INSERT INTO TABLE 3 VALUE('1004');
INSERT INTO TABLE 3 VALUE('1004');
INSERT INTO TABLE 3 VALUE('1004');
INSERT INTO TABLE 3 VALUE('1002');
INSERT INTO TABLE 3 VALUE('1002');
INSERT INTO TABLE 3 VALUE('1002');
INSERT INTO TABLE 3 VALUE('1002');
SELECT count (*), count (distinct nodeid)
of table1, table2, table3
where table1.nodeid = table2.nodeid and table1.nodeid = table3.nodeid;
SELECT count (*), count (distinct nodeid)
FROM table1, table3
where table1.nodeid = table2.nodeid;
SELECT count (*), count (distinct nodeid)
from table2, table3
where table2.nodeid = table3.nodeid;
SQL> SELECT MAX (CASE WHEN row_ind = 1 THEN ct END) ct_1,
2 MAX (CASE WHEN row_ind = 1 THEN distinct_ct END) distinct_ct_1,
3 MAX (CASE WHEN row_ind = 2 THEN ct END) ct_2,
4 MAX (CASE WHEN row_ind = 2 THEN distinct_ct END) distinct_ct_2,
5 MAX (CASE WHEN row_ind = 3 THEN ct END) ct_3,
6 MAX (CASE WHEN row_ind = 3 THEN distinct_ct END) distinct_ct_3
7 FROM (SELECT 1 AS row_ind,
8 COUNT (*) ct,
9 COUNT (DISTINCT table1.nodeid) distinct_ct
10 FROM table1, table2, table3
11 WHERE table1.nodeid = table2.nodeid
12 AND table1.nodeid = table3.nodeid
13 UNION ALL
14 SELECT 2 AS row_ind, COUNT (*), COUNT (DISTINCT table1.nodeid)
15 FROM table1, table3
16 WHERE table1.nodeid = table3.nodeid
17 UNION ALL
18 SELECT 3 AS row_ind, COUNT (*), COUNT (DISTINCT table2.nodeid)
19 FROM table2, table3
20 WHERE table2.nodeid = table3.nodeid)
21 /
CT_1 DISTINCT_CT_1 CT_2 DISTINCT_CT_2 CT_3 DISTINCT_CT_3
---------- ------------- ---------- ------------- ---------- -------------
50 2 26 5 25 2
There may be an easier way...
Tags: Database
Similar Questions
-
Printer Lexmark Pro 200. Does not print the correct colors. I restarted my computer and the printer is off but get the same result.
Hello
- What were the changes made before the problem occurred?
You try to run this fix and check.
http://Windows.Microsoft.com/en-us/Windows7/open-the-printer-Troubleshooter
If above does not work, try contacting Lexmark support for assistance.
http://www1.Lexmark.com/en_US/global-services/customer-support-services/index.shtml
-
I can't install Itunes. I get the SAME ERROR
I can't install Itunes. I get the following message is displayed: an error occurred during the installation of assembly ' microsoft. VC80. CRT, version = "8.05727.4053", type = "win32", publickeyToken = "1fc8b3b9ale18e3b","processorArchitecture ="x 86 ". Please refer to help and support for more information. HRESULT: 0X800736FD
I tried to uninstall & reinstall itunes several times. The same error message.
I am using windows vista 32-bit
Hello TP24,.
I found this in another post, and it can help you.
Posted by PuntXO:Check if the service of 'Windows Modules Installer' is started. Otherwise, you receive an error "not enough system resources to 1450" error trying to start, then this is the origin of the problem. To resolve the issue:
(1) Open regedit and change the following value:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control
Key: RegistrySizeLimit
Type: REG_DWORD
Value: 0xFFFFFF (4294967295)
(2) restart
(3) open an administrator command prompt and run SFC/scannow to verify the integrity of the modules of the system.
(4) install the updates of windows pending (surelly there are many of them)
Please reply back and let us know if this can help.
Thank you
Marilyn
Microsoft Answers Support Engineer
Visit our Microsoft answers feedback Forum and let us know what you think -
I can't get Adobe Flash Player to date on my Mac. It keeps telling me to close Safari, even if it is closed. I have tried every thing on the Adobe site to solve the problem with the same results still. I went to the site of both Mac and said to go to Adobe for a solution. It worked fine as a new Mac in February, but it will not update now, so no Flash Player ay all. Thanks for any help.
By clicking the red dot on the safari window it minimizes, but leave the program running.
To exit Safari completely, open Safari by clicking on the dock icon, and then choose Safari > Quit Safari to the upper left of the screen.
-
Get the same results without line of sight
Hi gurus,
My version of the database is 10.2.0.4.0.
I have a couple of tables as follows:
I would like to get a query to return for each group, the person with less person_number (if no one assigned to the group, then the query must return again with an empty person group). I know I can do this by using for example:CREATE TABLE xxgroups(group_number NUMBER, description VARCHAR2(30)); INSERT INTO xxgroups VALUES(1,'Group 1'); INSERT INTO xxgroups VALUES(2,'Group 2'); INSERT INTO xxgroups VALUES(3,'Group 3'); INSERT INTO xxgroups VALUES(4,'Group 4'); INSERT INTO xxgroups VALUES(5,'Group 5'); CREATE TABLE xxgroup_persons(group_number NUMBER, person_number NUMBER, first_name VARCHAR2(30), last_name VARCHAR2(30)); INSERT INTO xxgroup_persons VALUES(1, 1, 'John', 'Smith'); INSERT INTO xxgroup_persons VALUES(1, 2, 'James', 'Smith'); INSERT INTO xxgroup_persons VALUES(1, 3, 'Joe', 'William'); INSERT INTO xxgroup_persons VALUES(2, 4, 'Julien', 'Ford'); INSERT INTO xxgroup_persons VALUES(2, 5, 'James', 'Kelly'); INSERT INTO xxgroup_persons VALUES(3, 6, 'Francis', 'Smith'); INSERT INTO xxgroup_persons VALUES(5, 7, 'Jerry', 'Ford'); INSERT INTO xxgroup_persons VALUES(5, 8, 'Alfred', 'Willis'); INSERT INTO xxgroup_persons VALUES(5, 9, 'Jon', 'Preston'); COMMIT;
but it would be possible to achieve the same results without inline mode?SELECT group_number, person_number, first_name, last_name FROM (SELECT a.group_number, b.person_number, b.first_name, b.last_name , RANK() OVER (PARTITION BY a.group_number ORDER BY person_number) person_order FROM xxgroups a, xxgroup_persons b WHERE a.group_number = b.group_number (+) ) WHERE person_order = 1 ORDER BY group_number; GROUP_NUMBER PERSON_NUMBER FIRST_NAME LAST_NAME ------------ ------------- ------------------------------ ------------------------------ 1 1 John Smith 2 4 Julien Ford 3 6 Francis Smith 4 5 7 Jerry Ford
Thank you.You can try this function KEEP:
scott@orapdt> SELECT a.group_number, 2 min(b.person_number) as person_number, 3 min(b.first_name) keep (dense_rank first order by person_number) as first_name, 4 min(b.last_name) keep (dense_rank first order by person_number) as last_name 5 FROM xxgroups a, xxgroup_persons b 6 WHERE a.group_number = b.group_number (+) 7 group by a.group_number; GROUP_NUMBER PERSON_NUMBER FIRST_NAME LAST_NAME ------------ ------------- ------------------------------ ------------------------------ 1 1 John Smith 2 4 Julien Ford 3 6 Francis Smith 4 5 7 Jerry Ford 5 rows selected.
-
How can I get the same results from Google Images like in internet Explorer
If I search Google Images in IE8, I get a list of result pages with a fixed number of items per page. These thumbnail images download quickly, and under each image there is useful information about the content of the image and its source. Images on the next page doesn't download not unless if I select the next page in the list, so that the modem activity stops quickly.
When I use the same URL - www.google.com - in Firefox and go to Images, I get pages with an indefinitely large number of images of result. All images are stuck next to each other, and there is no other useful information from the text shown at all. If I try to scroll to the bottom of the screen, images more keep downloading. There seems to be no Google settings available in this view to limit the number of images per page.
Only problems with this is that I am currently limited to 56 KB connection. Images from this point of view download so slowly that they simply never complete in a reasonable time.
However, apart from the speed of connection, there is the question of the useful information from the missing text.
I can search for photos on startpage.com and get something like the old format of Google, but I can't receive the best list of results that I expect from Google. StartPage uses Google for their research on the web regularly, according to a note on the web search display. But if I go to Images, this note disappears.
I call it the traditional Google Images Search in Firefox?
Problem solved by saving a bookmark to Google and then to add by changing the & sout = 1 keyword in the URL.
When Google is accessible with this keyword, it will ship between web and image searches.
This example gets always the classic view of Google images.
-
SQL query to get the desired result
I have the array with the following values
Account Functional currency Billing currency Amount Header 5 101 USD USD 10 h 00 101 USD CAD 12 h 00 102 JPY USD 9 h 00 102 JPY CAD 3.00 102 JPY SGD 2.00 If the account has one different inv_currencypar that the functional currency and then
I have to summarize the amount in this account by viewing the billing currency
If the account has more than one other inv_currencypar that the functional currency and then
I have to summarize the amount in this account showing the functional currency as the currency of invoicing
I need output like this:
Account
Functional currency Billing currency Total amount Header 5 101 USD CAD 10:00 pm 102 JPY JPY 2:00 pm Can we get over output in sql without writing pl/sql program?
Hello
According to your specific needs, here's a way:
SELECT account
functional_currency
CASE
WHEN 1 = COUNT (DISTINCT NULLIF (invoice_currency
functional_currency
)
)
THEN MAX (NULLIF (invoice_currency
functional_currency
)
)
Of OTHER functional_currency
END AS invoice_currency
The SUM of (amount) AS total_amount
header5
FROM table_x
GROUP BY account
functional_currency
header5
;
If you would care to post CREATE TABLE and INSERT statements for your sample data, and then I could test this.
Is it possible to have 2 (or more) of different functional_currencies in the same account?
-
How to rewrite this query to get the correct results?
Friends,
DB: 9iR2
I need to get the name of the employee and the employee number that are not in the table of presence.
but this query is not the right answer.
Thank youselect e.eno,e.ename from empl e where e.eno not in (select a.eno from attendance a)
Depending on your data
SQL> create table attendance( 2 ENO VARCHAR2(5), 3 TDATE VARCHAR2(10), 4 IN_TIME VARCHAR2(6), 5 OUT_TIME VARCHAR2(6), 6 SHIFT_NO NUMBER(1)); Table created. SQL> create table empl( 2 ENO VARCHAR2(5), 3 ENAME VARCHAR2(75)); Table created. SQL> insert into empl values('11','AA'); 1 row created. SQL> insert into empl values('12','AB'); 1 row created. SQL> insert into empl values('13','AC'); 1 row created. SQL> insert into empl values('14','AD'); 1 row created. SQL> insert into empl values('15','AF'); 1 row created. SQL> insert into attendance values('11','23-3-2009','9.00','6.00',1); 1 row created. SQL> insert into attendance values('14','24-3-2009','9.00','6.00',1); 1 row created. SQL> insert into attendance values('11','25-3-2009','9.00','6.00',1); 1 row created. SQL> insert into attendance values('13','23-3-2009','9.00','6.00',1); 1 row created. SQL> insert into attendance values('15','23-3-2009','9.00','6.00',1); 1 row created. SQL> commit; Commit complete. select e.eno,e.ename from empl e where not exists(select 1 from attendance a where a.eno=e.eno); ENO ENAME 12 AB
Twinkle
-
How to get the same result on different characterset?
Hello experts,
I use
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production PL/SQL Release 11.2.0.3.0 - Production "CORE 11.2.0.3.0 Production" TNS for 64-bit Windows: Version 11.2.0.3.0 - Production NLSRTL Version 11.2.0.3.0 - Production
Needing a result even on my example.
SELECT ASCII('ˆ') -- when characterset is -NLS_CHARACTERSET WE8MSWIN1252 FROM DUAL; --result 136
SELECT ASCII('ˆ') -- when characterset is -NLS_CHARACTERSET AL32UTF8 FROM DUAL; --result 52102 but need 136
I need same result.
Thanks for your time...
EDITED RESULT.
Ask2Learn
You test something that you call "encrypted" data, which are not at all encryption.
For example speaking of letter t.
The CHR (ASCII('t') + 20) operation is pretty useless. You try to find the character that has the code binary and longer than 20 that the letter 't'. This can work with single-byte as WE8MSWIN1252 character sets, but it does not work with variable width as AL32UTF8 character sets. The letter 't' a code 0 x 74 in WE8MSWIN1252 and AL32UTF8. If you add 20 (decimal), you get 0 x 88. Byte 0 x 88 is a valid code in the WE8MSWIN1252, but is not a valid code in AL32UTF8. Bytes in this range may bytes of continuation in AL32UTF8, i.e. a second, third or the fourth byte of a multi-byte sequence.
The "circumflex accent" character code 0 x 88 (in WE8MSWIN1252) has the code of two bytes 0xCB 0 x 86 in AL32UTF8.
So, why not take a look at DBMS_CRYPTO integrated
Hope this helps
Hamid
-
Can you explain to me why I do not get the same result (vSphere Client Web vs API)
Hello
When I create a new switch logic of vSphereWebClient/network & Security/LogicalSwitches
I don't see a RESTClient 'GET nsx_url/api/2.0/vdn/virtualwires» '.
Why?
Thank you
Logical switch how do you have in your environment. This particular API call you are using has a paging feature and by default returns only the first 20 objects.
The NSX 6.2 API Guide
where? PageSize = XX & YY = startindex specifies the results of the query to the major pages. The default pagesize is 20 and default startindex is 0. -
SQL query to get the given result
Hi friends
My data in the table are given below
user transaction_date transaction_type
1 1st August 2011
August 2, 2011 1 c
1 3 August 2011
1 b 3 August 2011
1 August 4, 2011 a
1 b 4 August 2011
2 3 August 2011
2 b 3 August 2011
August 4, 2011 2 c
2 b 4 August 2011
2 August 5, 2011 a
2 b August 5, 2011
2 August 7, 2011 a
2 b 7 August 2011
I want the count for each user as, how many times he made a transaction type transaction immediately after 'b' type?
As the output of above data should be
number of users
1 2
2 3
Thanks in advance :)Maybe (NOT TESTED).
select "user", count(criteria) "count" from (select "user", transaction_date, transaction_type, case when transaction_type = 'b' and lag(transaction_type,1) over (partition by "user",transaction_date order by transaction_date,transaction_type) = 'a' then 1 end criteria from the_table ) group by "user" order by "user"
Concerning
Etbin
-
I need assistance of query SQL, a query to get the same without union clause
EmpNo, ename sum (sal) sum (deptno)
200-2000-10 Tom
201 3000 10 smith
Alfred 202 20 3000
40 8000 totalselect NVL(TO_CHAR(employee_id), 'Total'), max(last_name), sum(salary), sum(department_id) from employees group by rollup(employee_id), ()
-
Sometimes certain pages of Firefox do not load correctly, there are very few pictures and text on the page is not material to the normal website.
I can still maneuver around, but it is extremely difficultHello
Please try pressing Ctrl + F5 on the keyboard when a problematic site.
-
How do I get the same results in the Union vs join statement statement
Hello
I have 3 related tables and you must combine customers table1 and table3. My Control Panel is constantly evolving based schedule changes or order_completed qty. I have two problems that I can't solve.
Table 1: Manager has fields {managerId, Mangager_name, customerId & customer}
Table2: client includes the fields {customerId, orderId, product manager, managerId and}
Table 3: order has fields {orderId, customerId, customer, date, amount_order, qty, order_completed}
1. I need check what are customers or away from table Manager / order based on customerId and managerId
Here is the example of union that I would like to convert a join because I need to include aggregated order table fields and the customer at table eating based on the field of the client:
Select m.client
Manager m
where m.managerId = 22
Union select m.client in order o where o.customerId = 65
2. create a view or a temporary table (called State) to the report with an additional field that determines if the client has been found in the roll of the order and not in the table Manager.
Example of a view of the State or the temporary table select output
rownum. customer | status
1. Mary | The two Tables
2. Tomas | The two Tables
3. John | Customer table
4. April | Customer table
Thanks for the helpHello
SQL> create table manager (m_id number, m_name char(10), customer_id number, client char(10)); Table created. SQL> SQL> insert into manager values (10,'M_1',111,'AAA'); 1 row created. SQL> insert into manager values (20,'M_2',222,'BBB'); 1 row created. SQL> SQL> create table customer (C_id number, m_id number, order_id number); Table created. SQL> SQL> insert into customer values (111,10,5000); 1 row created. SQL> insert into customer values (222,20,5001); 1 row created. SQL> insert into customer values (333,NULL,5002); 1 row created. SQL> create table order_dt (Order_id number, c_id number, Client char(10)); Table created. SQL> insert into order_dt values (5000,111,'AAA'); 1 row created. SQL> insert into order_dt values (5002,333,'CCC'); 1 row created. SQL> select rownum, a.c2, CASE WHEN ((a.ct2+a.ct1) = 2) THEN 'Both Tables' 2 WHEN (a.ct2 = 1) THEN 'Client table' 3 WHEN (a.ct1 = 1) THEN 'Manager table' 4 ELSE 'NULL' 5 END AS status 6 from ( 7 select NVL(m.Client,o.Client) c2,count(m.Client) Ct1, count(O.Client) ct2 8 from manager m, 9 customer c, 10 order_dt O 11 where m.m_id(+) = c.m_id 12 and c.c_id = O.c_id(+) 13 group by m.Client,O.Client 14 ) A 15 ; ROWNUM C2 STATUS ---------- ---------- ------------- 1 AAA Both Tables 2 CCC Client table 3 BBB Manager table
-Pavan Kumar N
-
I have a Dell computer with a 32-bit version Vista Ultimate factory loaded. Service Pack 1 is loaded. I tried to load Vista Service Pack 2 several times by using the following procedure and it does not load.
-From Microsoft technical support I click Download (using a cable modem) and click on the file to run. The file MB 475 downloads in about 5 minutes.
-Click on install Vista Service Pack 2 and it starts to install
-After about 10 minutes, a message appears "installation was not successful 800F081F error Code. A system error not install the service pack. Please download and run the tool to "Check for System Update Readiness". »
-J' I download system analysis tool and start the installation.
-Get a message "Installation update for Windows (KB947821) update 1 of 1"
-After a long time, a message appears saying that the Installation has failed with an error Code 800706BE.I repeated this process several times and always get the same result.
My McAfee security software and spyware blocker is disabled during this processThe update is not installed successfully, you receive a message, and the computer restarts when you try to install an update in Windows Vista
http://support.Microsoft.com/kb/949358See also the post of 'Response' in this discussion partners: http://social.answers.microsoft.com/Forums/en-US/vistainstall/thread/ad5159b6-edc7-4c45-842a-c8197aec3e07
========================
Free unlimited installation and compatibility support is available for Windows Vista, but only for Service Pack 2 (SP2). This support for Windows Vista Service Pack 2 (SP2) is valid until November 26, 2009. Availability of support chat or messaging differs depending on your location. Go to http://support.microsoft.com/oas/default.aspx?prid=13014&gprid=582034 & select appropriate category (i.e., download problem;) Installation problem; Problems after installing a service pack). ~ Robear Dyer (PA Bear) ~ MS MVP (that is to say, mail, security, Windows & Update Services) since 2002 ~ WARNING: MS MVPs represent or work for Microsoft
Maybe you are looking for
-
Satellite Pro L20 - broken cover - part order
I have a portable satellite Pro L20 for 4 years since 2006. I must say that the quality of Toshiba is good.Over the past 4 years I have no problem with this laptop. Recently and finally my front cover of the laptop decompose. When I am looking for re
-
get nothing when connect my HP slate to my TV, what am I am I doing wrong? pls help
I tried to connect my slate hp7 to my TV to watch Netflix from my tablet, but nothing happens. I'm not good with gadgets, I do something wrong? pls help
-
Windows would not open.
-
Upgrade Vista to Windows 7 or 8
I have Vista and put to upgrade to Windows 7 or 8. I have a desktop PC and an iPad. I don't know which option is the best for me, someone give me their thoughts.
-
15 r030wm: 15 - r030wm windows 7 USB drivers
Hello! I have spent in my laptop for windows 7. I downloaded and installed all the drivers w7 since the support site. However, the icon of USB 3.0 in the Device Manager displays a yellow exclamation point. I tried to install the driver but it says th