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 help

Hello

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

Tags: Database

Similar Questions

  • When I type in the address bar, yahoo search results appear. This just started happening, he showed the results of google search before. How can I get the results from google instead of yahoo?

    If I type "NBA" in the address bar, I get results from yahoo. I don't want the results of yahoo, I want Google results. This just started today. How can I get Google search results to show after typing in the address bar?

    1. Type of topic: config in the address bar and press on enter
    2. Accept the warning message that appears, you will be taken to a list of preferences
    3. Locate the preference keyword. URL, right-click on it and choose reset

    This will restore it to Google.

  • How can I get the data view to display the same amount of time I save?

    I use the Sound and Vibration Measurement Suite.  In the data view, I display a graph of time, the power spectrum, the Color Map and the waterfall.  I am also showing strength in numbers group for several bands and doing cutting-edge research.  I record 100 ms of the transient wave.  In the data view, why the temporal plots show several seconds of data?  What determines how much time will appear in the data view?  More important, the power spectrum reflects the power for the entire of several seconds of data displayed?  Same question for power in the values of band and cutting-edge research.  I want to just this data displayed for 100 ms of the wave that I record.  So, how can I get the data displayed (waveforms) and power numbers come only 100 ms of the recorded wave?

    Finally, what is the best way to make account concisely the recorded data?  By slide numbers on the Documentation tab is not concise, because it comes with graphics, etc..  I tried save as ASCII/LVM, but I get a bunch of stuff intermiated I don't care.  Help?

    Hi TimRsandiego,

    SignalExpress is programmed to display graphs with default scales based on the type of action, it's reading. These scales and settings can be changed by right-clicking on the graph, and then select Properties.

    If you are interested to learn more about how to use SignalExpress, I would recommend checking out some demonstrations/tutorials on NI.com. You can find some of these demos at the following location:

    Let me know if you have any other questions.

    Kind regards

  • How can I get the ps3 game system to pick up a wireless internet connection, to a desktop computer in the same room?

    HP Desktop/Windows 7. Wireless Internet receives, of Linksys Wusb600n Adapter.Then for Playstation 3 wireless system?

    How can I get the ps3 game system to pick up wireless internet, a desktop computer in the same room, but the desktop computer is picking up wireless internet from a Linksys wusb600n adapter.and is a secure signal I have permission and the password of the neighbor. It is in the basement of the House and I can't access wefi for the coming thing only ps3.the is the usb cord pluged into the desktop. its for kids, any advice would be greatly appeaciated. Thank you

    You can use the wireless router but you cannot use pc as a wireless router.

    Upcoming ps3 games

  • I have a laptop broke the rocovery disk not good ahy, I need the windows vista disk operating system how do I get the same themes?

    I have a laptop broke the rocovery disk not good ahy, I need the windows vista disk operating system how do I get the same themes?

    If Windows Vista was preinstalled on your computer, contact the manufacturer of your computer for a replacement CD. If you purchased a retail version of Windows Vista, contact Microsoft.

    This article in the Microsoft Knowledge Base has the details: How to replace Microsoft software or hardware, order service packs and updates of product and replace product manuals . Boulder computer Maven
    Most Microsoft Valuable Professional

  • By creating a form that has several text boxes to a single character on the same line, how can I get the cursor to go in the next text box automatically after inserting a character?

    By creating a form that has several text boxes to a single character on the same line, how can I get the cursor to go in the next text box automatically after inserting a character?

    Create a text field and use the option 'comb n characters.

  • How can I get the 6 digit number to associate my watch.  It doesn't give me a 5-digit number?

    When I try to manually associate my watch it only gives me a 5 digit number, but not the number 6 to complete the pairing.  How can I get the 6 digit number?

    Hello

    When pairing manually, you must press the name of 5 digits on the screen of your iPhone (when he shows the same device name that is shown on your watch, after typed it on your watch's 'i'):

    Your watch then displays a six-digit code, you will then enter on your iPhone:

    More information:

    Set up your Apple Watch - Apple Support

  • How can I get the tabs colorful to use different distinct colors for 2 gmail accounts?

    Under Firefox 29.0.1 iMac OSX 10.9.3. I have multiple Google accounts: 2 1 Google Calendar and gmail accounts. Colorful tabs add-on will allow me to choose a color for a gmail account, but it also uses this same color for the other gmail account. How can I get the different colors on 2 gmail accounts?

    In addition, colorful tabs is also the same for my homepage (google.com) and my google calendar. How can I get different colors on these 2?

    Personally, I use 'Fabtabs' for my mozilla FireFox.

    https://addons.Mozilla.org/en-us/Firefox/addon/FabTabs/

    This add-on has problems like that when I use it.

  • I use 3.6. How can I get the update to look like this? I really don't want to use IE or MSN but if that's all that I have, then let me know. Thank you

    I use 3.6 because I like how it spans my toolbars instead of just me giving bookmarks in the corner and firefox solitaire in the opposite corner. I know that I can open the bookmarks bar, but it's not the same. I want that the file, editing, display, history, bookmarks, tools, help toolbar throughout. How can I get the new firefox to do this

    This should duplicate the image you posted what you look for Firefox 5 in (this application should be BLOCKED) double wire.

    Menu bar

    • Right click on a blank space at the end of the tab bar, click on 'Menu Bar' to place a check mark
    • Checked menu bar = bar menus; Firefox button
    • Unchecked menu bar = bar menus; The Firefox button
    • Other methods of doing the same thing:
      • Click the Firefox button > Options, click on menu bar
      • Quickly activate/disable Menu bar, power: ALT + V + T + M

    Tabs on top

    • Right click on a blank space at the end of the tab bar, click "Tabs at the top" to remove the check mark
    • Tabs on top checked = tabs at the top toolbars
    • Tabs on top unchecked = tabs below the toolbars
    • Other methods of doing the same thing:
      • Click the Firefox button > Options, click on the tabs on top
      • Toggle Quick tabs on top on / off: ALT + V + T + T

    Separate the Reload / Stop button and the position of the Home button

    • Open the Customize; do one of the following:

      • Right click on the empty space at the end of the tab bar, choose "Customize".
      • Click the Firefox button > Options > toolbars
      • If you use the menu bar, click View > Toobars, click Customize
      • Quick open window customize: ATL + V + T + C
    • the buttons Reload and Stop appears distinct between the URL/address bar and the search bar. When the window customize is open, do one of the following categories, to separate the buttons:
      • Drag the button to the left of the Reload button
      • Drag a 'space' between the Reload and Stop buttons
      • Drag one or two buttons anywhere on the separated by a 'space' or another icon Navigation bar or reverse the order of Stop-Reload to keep them separated
    • Drag the button to the right of the search bar
    • Click "Done" in the bottom right of the window customize when you are finished.

    Color backward/forward, home, the buttons Stop and reload

    If this answer solved your problem, please click 'Solved It' next to this response when connected to the forum.

    Not related to your question, but...

    You must update some plug-ins:

  • I just download v4.0. How can I get the third arrow back button navigation, which allows the selection of a page forward or back?

    I just download v4.0. How can I get the third arrow back button navigation, which allows the selection of a page forward or back?

    Don't know how to get the exact button back (sorry) I dig around too much to do...
    But! Today, I found by chance that by clicking and holding on the back button the same box to popup in last-12-sites and you can stream on the list to return to that particular site.

    Not exactly what you (and me) tried but at least the functionality is there.

    Good luck!

  • How can I get the airplay icon to appear? Changing the settings of firewall does not work

    How can I get the airplay icon to appear? Changing the settings of firewall does not work

    Hello Drjoe378,

    I understand that you do not see the AirPlay icon in iTunes on your Mac. If you have verified that your firewall is disabled or that the problem occurs regardless of the status of your firewall, there is a little more that can help return your ability to connect to AirPlay devices.

    1. Make sure you have the latest version of iTunes and Apple TV software.
    2. Connect your computer and other devices on the same network Wi - Fi. If you are using Ethernet, connect the two devices on the same router or hub. If you use the Wi - Fi and Ethernet, plug your device AirPlay the same router that your computer uses for Wi - Fi.
    3. Restart your computer, device AirPlay and network router.
    4. Because some Airplay devices include a power switch for AirPlay option, look for the option in the settings and make sure that the feature is enabled. Refer to the user guide of the device for more information.

    Use AirPlay to stream content from iTunes on your computer wireless
    https://support.Apple.com/en-us/HT202809

    All my best.

  • How can I get the string value displayed on a digital control defined for the relative time.

    I have a digital potentiometer to display relative time in increments of 30 minutes.

    I want to record the value displayed on the control string.  Unfortunately, when I use the "convert to decimal string.vi" number, the resulting string is just the value in seconds.

    How can I get the value as a string? (for example 01:30 for an hour and thirty minutes)

    Thank you

    Sean

    Hi Sean.C!

    M_Peeker's suggestion is a good thing.  A stage that could clarify things is that you must set the % t <%H:%M> format string entry.

    < br / > Kristen:.

  • How can I get the area of a balloon with video analysis

    Hallo
    If I have a video analysis for a ball, how can I get the box?

    Vision Wizard as follows:

    First clean up your image to maximize the contrast between your ball and the background.  It is usually a combination of blurring/smoothing/cleaning.

    Then, run a threshold to generate a binary image that ideally contains only your ball.

    The use of the particle analysis for information on the ball.  One of the results of the stage of the analysis of the particle is the area.

    Most of the difficulties for this type of analysis is to get a clean enough to work with image.  If you can put a picture of the sample, I might be able to generate a Vision Assistant Script that performs the steps described above.

  • I have all the games Age Of Empires, the versions of Windows and I changed to a Mac computers. How can I get the Mac version of the games and use my existing serial keys?

    I have all the games Age Of Empires, the versions of Windows and I changed to a Mac computers. How can I get the Mac version of the games and use my existing serial keys?

    Hello

    As you have bought Age of Empires for Windows OS, you will not be able to install the same copy of Age of Empire Windows version on Mac. However, you can contact the telephone support for confirmation on this issue.

    Here is the link:

    http://support.Microsoft.com/kb/295539

  • How can I get the volume on the meter display screen back?

    Hello

    I have a small problem... for some reason counter display on screen for my volume when you press the keyboard suddenly disappeared, I would like to get that back.

    I found this thread in the forum http://h30434.www3.hp.com/t5/Notebook-Display-and-Video/how-do-i-get-the-volume-on-screen-display-me... another was having the same problem I have. The only difference is that I use HP Pavilion G7 with Windows 7.

    Please help, thanks.

    Hello

    You can use the same OSD utility listed in the other thread - it is on the link below.

    http://ftp.HP.com/pub/SoftPaq/sp55001-55500/sp55152.exe

    DP - K

Maybe you are looking for

  • Synchronization error messages

    Hello. Since Monday I get on Firefox 31 synchronization with a Windows 8.1 machine errors:"Sync has encountered an error during synchronization: unknown error." Here's the synchronization log: http://pastebin.com/fuY8u572 Looks like it's sync everyth

  • Transfer photos from the camera for iPad/iPhone

    Could someone tell me how to copy pictures from my Panasonic FZ200 camera directly on my iPad/iPhone without having to use my laptop. I guess I should get a cable to a description. Thank you.

  • My iMac will not close since the last update

    Since the last update for El Capitan, my iMac does not stop and I hold the power button so he can close. Has anyone else had this problem? I'm nervous to download the update on my Macbook pro in case the same thing happens. Also has anyone had a solu

  • iPhone 4 iOS 7.1.2 dislikes I have Cloud

    I have an iPhone 4 iOS 7.1.2 and an iPad Mini iOS 9,3,2. I'm on a Windows 10 iCloud. The iPad works perfect sending photos to the PC and the iPhone and save it in the cloud. However, the iPhone does not seem to send anything in the cloud, or the iPad

  • Where did my WLan connection part for Satellite Pro A100

    Hi all I recently reinstalled xp on my Satellite Pro A100 and I can not get the wireless connection works.He worked prior to re - install. I downloaded a bunch of driver but cannot make it work. any suggestions? THXTim