What kind of join should i use?

Hi
I have the following mock example
WITH data AS(SELECT  99.99 retail_value, 6545 sales_value, 7 tran_type from dual union all
             SELECT  776.99 retail_value,774 sales_value,   8 tran_type from dual union all
             SELECT  929.99 retail_value, 56 sales_value, 8 tran_type from dual union all
             SELECT  44.99 retail_value, 35 sales_value,   8 tran_type from dual union all
             SELECT  776.99 retail_value,17 sales_value,   7 tran_type from dual union all
             SELECT  44.99 retail_value, 2 sales_value,   7 tran_type from dual),
     commercial_model AS(SELECT 1 com_id, 7 tran_type from dual union all
                         SELECT 1 com_id, 8 tran_type from dual union all
                         SELECT 2 com_id, 8 tran_type from dual union all
                         SELECT 2 com_id, 7 tran_type from dual)      
     SELECT * FROM data,commercial_model
     WHERE data.tran_type=commercial_model.tran_type
     AND com_id= /*input_parameter*/com_idNormally an input parameter is passed in to determine the com_id. However in the piece of work i'm having trouble with no com_id is being passed in so the sales report is picking both commercial_model transaction types and producing duplicate results. When i sum the sales_value field the figure is twice it should be.
Is there a way of joining the two tables so that i dont get these duplicates for tran_type.
Cheers in advance.

WITH data AS(SELECT  99.99 retail_value, 6545 sales_value, 7 tran_type from dual union all
             SELECT  776.99 retail_value,774 sales_value,   8 tran_type from dual union all
             SELECT  929.99 retail_value, 56 sales_value, 8 tran_type from dual union all
             SELECT  44.99 retail_value, 35 sales_value,   8 tran_type from dual union all
             SELECT  776.99 retail_value,17 sales_value,   7 tran_type from dual union all
             SELECT  44.99 retail_value, 2 sales_value,   7 tran_type from dual),
     commercial_model AS(SELECT 1 com_id, 7 tran_type from dual union all
                         SELECT 1 com_id, 8 tran_type from dual union all
                         SELECT 2 com_id, 8 tran_type from dual union all
                         SELECT 2 com_id, 7 tran_type from dual)      
     SELECT a.*, b.* FROM
          (select *  from data) a,
           (select distinct tran_type from  commercial_model
             where com_id = nvl( /*input parameter*/), com_id)
             ) b
     WHERE b.tran_type=a.tran_type

Similar Messages

  • My iMac was infected with a virus or malware the other night. I was told that I didn't have any firewall protection. How do I fix that? And what kind of software should I use to protect my computer from further attacks?

    I am running OS X Version 10.9.5 on n iMac I brought in 2011. Had a virus or malware attack the other night and a window opened with a # to call for help. Didn't know if I should trust the # but ended up calling it anyway and paid to have them 'fix' things. Was told I didn't have firewall protection. Am not sure if I do now. [It still says to allow all incoming connections]. So what do I do now? And what kind of antivirus program is recommended?
    Firewall

    Read "Ransomware" web pages.
    Assuming you let the scam outfit remotely control your Mac, the information on it can no longer be considered secure. Neither can the Mac itself. You should immediately shut it down and take actions to prevent or recover from identity theft, which is quite likely to have occurred. This means contacting the financial institutions and other companies that may permit access to your accounts using login names and passwords, canceling and replacing credit cards, and similar actions that only you can know.
    Determine if you can contest the charge made to your credit card for this criminal transgression.
    And what kind of antivirus program is recommended?
    None. The Mac is highly secure against malware or virus intrusion, but nothing can prevent you from willfully installing dubious software or granting remote access to criminals. No "anti-virus" software in the world will protect you from that. The OS X application firewall is not intended to prevent this sort of occurrence.

  • HT5299 What kind of cable should I use for movies on my macbook pro if I want to watch it on my 60 inch tv?

    What kind of cable for my macbook pro, do I use to watch movies on my 60 inch tv ?

    Which model MacBook Pro do you have (e.g., "15-inch Late 2011")?
    Clinton

  • What kind of motor should I use for lifting a heavy load?

    I'm working on an automation application in which I need to control a lifting mechanism with heavy load (about 120 lbs).  I will be getting constant temperature readings and based on that data I can determine the rate of change of the temperature.  If the temperature rate is too fast then I need to be able to slow down the motor, if it is too slow then I need to speed it up.  I'm looking for some support with choosing the right motor and hardware so that I have full speed control, while still being able to lift this heavy load, hold the load in a certain position, and then raise the load back to its original position.  I was considering a stepper motor for this due to its ability to brake so the load can stabilize.  Is this the right call or should I use a continuous servo?  Where can I get such a stepper that can handle this type of load and has software that interfaces with LabVIEW?  Would I be safe getting low-cost hardware for this application?  Any guidance would be sincerely appreciated.  Thanks.

    Thanks for your replies to this topic.  I just discovered the worm gear option yesterday while talking to a professor.  I think that is the route we are going to take because the DC motor won't be as expensive as a high-torque stepper or servo.  Also, I have three engineers that will be calculating the motor size based on gear reduction, spool size, cable length, and the load that we have to lift (which is about 120 lbs.).  If any of you would like to suggest a motor size, that would be great too.  I'm thinking something around 1HP should probably do it.  My goal is to stay cost-effective while making an easy apparatus.  I know that the worm gears may also be inefficient at times but it seems like the best solution for this application.  Not to mention it's not to hard for our mechanical engineers here to make the spool and bearings.  And I believe you can buy a DC motor that interfaces directly with a worm gear.  However, a follow up question is what computer hardware do I need to control the voltage of the motor so I have speed control?  Is this done through an RS232 board?  My output from the LabVIEW program will be voltages, from which device is that binary signal converted into physical voltage?  Thanks for your help so far.

  • What kind of SSD should I use and will it benefit my laptop?

    My Macbook Pro (either early or late 2008, not sure) is in dire need of an upgrade. I'm thinking about upgrading it to a 128 GB SSD-drive and was wondering if anybody has experience with the performance-gains (especially in Adobe Photoshop) and what kind of drives anyone would recommended? It's quite difficult to find recent info on this online so any help would be greatly appreciated.
    Cheers,
    Michiel

    Ah, this opens up new perspectives. Could you shed some light on the RAM-subject? How can I find out what model I have and what kind of RAM I need? I mean, logic dictates I need the same RAM I have now, but I'm sure there has been some development on those voodoo-sticks that should make them faster etc.
    Also, any info on the SSD-thing is still greatly appreciated. Upgrading RAM ánd HD is ofcourse better then just switching to an SSD..

  • What kind of analysis should i use for these signals?

    i'm developing a lie detection system,i have one respiratory sensor and a hand grip heart rate monitor to acuire the physiological signals from the sensors.i have attached a screenshot of the application.the top signal represents the heart beat and bottom one is respiratory signals.my question is that what analysis mwthods should i be using for these signal types?would you please care to help me on this? thank you.

    Thanks for your replies to this topic.  I just discovered the worm gear option yesterday while talking to a professor.  I think that is the route we are going to take because the DC motor won't be as expensive as a high-torque stepper or servo.  Also, I have three engineers that will be calculating the motor size based on gear reduction, spool size, cable length, and the load that we have to lift (which is about 120 lbs.).  If any of you would like to suggest a motor size, that would be great too.  I'm thinking something around 1HP should probably do it.  My goal is to stay cost-effective while making an easy apparatus.  I know that the worm gears may also be inefficient at times but it seems like the best solution for this application.  Not to mention it's not to hard for our mechanical engineers here to make the spool and bearings.  And I believe you can buy a DC motor that interfaces directly with a worm gear.  However, a follow up question is what computer hardware do I need to control the voltage of the motor so I have speed control?  Is this done through an RS232 board?  My output from the LabVIEW program will be voltages, from which device is that binary signal converted into physical voltage?  Thanks for your help so far.

  • What Kinde of program should I use for mastering?

    I had a litle problem with mastering my songs what I made with Logic Pro X is not enough laud. I need some help that what is a program to use mastering?

    You can master your tracks in logic. Bounce the song and import into a fresh logic project, then just apply your mastering processes there. However, mastering is a task that does require a very special skill set and a very good listening environment. Just having the software doesn't make a good master.
    Cheers,
    Jazz

  • What kind of path should be used in a *portable* .getResource()?

    I am porting to NetBeans an application that was running fine under JBuilder. There is one type of statement that refuses to be ported (getResource()).
    The application contains a lot of lines like this:
    url = AnnualReportsDialog.class.getResource("images/CheckMark.gif");Even the JBuilder tutorial has the same kind of file access relative to some current or default directory:
    ImageIcon image1 = new
    ImageIcon(hello_world.HelloWorldFrame.class.getResource("openFile.png"));When the "url" line above is reached, the getResource() fails.
    I have tried several variations:
    url = AnnualReportsDialog.class.getResource("C:\\images\\CheckMark.gif");
    url = AnnualReportsDialog.class.getResource("C:/images/CheckMark.gif");but they don't work.
    Perhaps something has changed between JRE 1.4 and 1.6?
    What is the more general solution to the problem of Java not having a 'chdir()'? My app runs on Windows but I would like to run in in *ix as well.
    Is there a way to place all those GIFs in some sort of resource, that can be carried around different O/Ss and filesystem paths? I would like the following to work under any OS:
    getResource("images/CheckMark.gif");
    TIA,
    -Ramon

    X-FI PCI 32Bit Cards?with 33MHz will fit into a PCi 64Bit slot. (The Slots must only support PCI 2.2 or later.)?Even a PCI-X slot can dri've PCI 32 33MHz cards. Downside: the PCI bridge will clock down all connectet PCI slots to 33MHz. Most PCI 64Bit slots supports 66MHz clock speed.
    Older PCI cards like Audigy will run in a 2. or lower?compatible PCI Slot.
    Message Edited by fffcmad on 03-26-2008 0:3 PM

  • What kind of card should I use with my DAQ setup?

    We are using the e-series multifunction DAQ PCI-MIO-16XE-10 and are looking for a good DAQcard to go with it. We are wondering if there is a DAQcard with 16 bit analog output and higher than 20 kS/s.

    National Instruments currently doesn't have a 16-bit analog output PCMCIA card. There is a 16-bit analog input card, however. For those customers interested, I am referring to the DAQCard-AI-16XE-50.
    If speed is critical, you might still consider the 12-bit DAQCard-6062E. It has a single-channel analog output rate of 850 kS/sec.

  • What frame rate timeline should I use for 1080p 60fps premiere pro

    When using 1080p 60fps clips what sequence should I use when creating a timeline that would work the best for slow mo application?
    I read that you should use a 24 fps timeline but i'm not sure?
    Also I have a few 720 @ 120 fps, should I create a separate sequence for that and what kind of timeline should I use since cs5 only has 1080 @ 60fps option?

    24 is a good frame rate for most animations but some people like 30 and for the max stress on user systems and animation smoothness, use 60.

  • What kind of cloth do I use to clean my iPod nano?

    I just got my white nano this morning, and I've been reading all these terrible stories about people cleaning their nano with a cloth only to scratch it up terribly. So, what kind of cloth should I use then? And where would I get it? I heard people talk about displex (sp?) to remove scratches. Does anyone have first hand knowledge that it really works?
    Thanks!

    AFter I wiped kleenex tissue to clean the fingerprints off my nano, I looked and saw many little scrathes that werent there before. THe sratches were only visible when you looked at the nano at a certain angle and under a certain amount of light. I suppose the scrathes were made because of the little particles in the kleenex tissue. Unfortunatly, the little particles were also left behind on the nano after wiping it so it got annoying having to wipe the particles off.

  • What kind software we should use under VISTA to creat new partition.

    hi,there. i've use the boot camp to install the window vista in my macbook. but the boot camp only creat one partition for it. therefore all the partition i have under vista is C partiton. i want to divide that C partiton into 2 or more partitons, but i just wonder will that gonna destroy the boot information for Mac OS? what kind software i should use to avoid that problem? thanks.

    Don't know. Never used it. You should probably post your question in the Boot Camp discussions
    http://discussions.apple.com/forum.jspa?forumID=1165

  • What external Hard drive should I use for Final Cut Pro?

    Hi:
    I have a Mac Pro and I'm planning to work with HD. What external hard drive should I use?
    PD: I have a NVIDIA on a PCI Express graphic slot.
    Thanks,
    Cabezon

    You'll need to be much more specific; there are 20 or 60 different kinds of high definition. Some require nothing, some require superfast RAID, some require specialized hardware support.
    bogiesan

  • What kind of Antivirus should be installed in SAP Server?

    Hi all,
    My customer wants to install antivirus in their sap server. but i don't know what kind of antivirus should be installed.
    Currently in customer sap server, it has the high performance (high memory) for sap b1.
    So I have 2 concerns.
    1. Why sap b1 and sap supporting software use high memory while in my pc use less memory?
    2. What kind of antivirus should be installed on SAP Server?
    Noted:
         1.SAP B1 version: 9.0
         2.No add on running.
    Thanks
    TONY

    Hi
    Check the below thread it may helps you
    Anti-virus / SAP B1 Settings
    With Regards
    Balaji Sampath

  • What kind of camera can I use??????

    I need to measure crack length in fatigue test of an Aluminium sample automatically. For example, the camera can take shots (Images) every 4000 cycles (fatigue load cycles), maybe more cycles.
    For my test, I need to measure both sides crack length (right side and left side of specimen centre line), shown in Fig1.  So I need to take shots both crack tips at the same time, which means camera must have a large field view and the resolution should measure 0.01mm, to see both crack tips clearly. At the end, I must be able to acquire images from Labview. I can save all the images into my fold from Labview, then I can measure crack lengths in left and right side from every image.  Fig1. sample size and crack tip
    Would you please give me any suggestions on the characteristic/specifications of this kind of camera?
     What kind of camera can I use? How much this kind of camera? Where can I order this kind of camera?
    Attachments:
    camera-Fig13.jpg ‏16 KB

    Hi Cran.
    You might want to put this topic into the Hardware Forum instead.
    It seems that this isn't much of a LabView question......
    Regards BCL
    Don't forget to rate a good Answer....
    Here should be some cool signature
    But there's NOT
    LV7Express, LV8.5.1

Maybe you are looking for

  • How to print 9x12" pdf from Acrobat on 11x17"?

    This should be easy to do, but the dialog boxes in Acrobat won't let me print a 9x12" pdf centered vertically on 11x17" at 100% on our HP 9500 laser printer. Instead I get an 8.5 x 11" sized printout, scaled down (9x12" doc scaled to fit 8.5x11" pape

  • No safe browsing?

    Howdy - In Safari/preferences/security, under my Fraudulent Sites option, I have this message - "The Google safe browsing service is unavailable - no updates have occurred in 20 days". Does anyone know why this is? Thanks.

  • AR:  Interest on overdue balances

    Hi Gurus How should one set up interest for debtors, so that it takes the payment terms into account.  I tried everything but it seems SAP calculates interest on outstanding items ignoring the payment terms.  If I create an invoice with yesterday dat

  • I need a Tip on how to do that

    Hi! I want to programm a Java Pop3-Checker, means a little app running in the systray and checking for new incoming mails in every specified interval of minutes. So my question is: How can I notice if there have new messages arrived in the Inbox, and

  • Can we Manage SCVMM Virtual Machine using App Controller

    Hi All,         Today I have configured one APP controller 2012 R2, already I have a SCVMM 2012 R2 environment which is managing 10 Standalone Hyper-V Host with 50 VM's. Question: Is that Possible to Manage the VM's (not part of cloud) in App COntrol