get the unique values

Hello world

I want a little help to get some unique records in the table. I know that it can be very easy, but I don't know why I can't

Please help me

I'm working on Oracle 11 g DB and I use the plsql allround automation tool

I want to give example so that it will be very easy to understand

Table1 below.

CREATE THE TABLE1 TABLE:

(contract not null, number (10))

number (10) client.

delivery_type number (10));

insert into table1 values (1,1,1);

insert into table1 values 2.2.1;

insert into table1 values (2,22,1);

insert into table1 values (3.3.1);

insert into table1 values (3,33,1);

insert into table1 values (3,333,1);

Select * from table1;

CONTRACTCUSTOMERDELIVERY_TYPE
1111
2221
32221
4331
53331
633331

as you can see for the contract 2 and 3 I get 2 & 3 lines (since the clients are different I agree we receive multiple contracts)

but in that contract 2 and 3 I don't want that these contracts including a corresponding customers in another table with a type_code = "email".

create the table2 table

(customer number (10),)

Type_Code varchar2 (10));

insert into table2 values (22, 'EMAIL');

insert into table2 values (33, 'EMAIL');

insert into table2 values (333, 'EMAIL');

Select * from table2;

CUSTOMERTYPE_CODE
122E-mail
233E-mail
3333E-mail

now I want a query that gives me the result like this

but I want the result like this

CONTRACTCUSTOMERDELIVERY_TYPE
1111
22221
33331
433331

I also want that contract 1

So basically I want all contracts, but if all contracts were duplicated (2 or 3 lines), I wanted to choose only the customers that has the matching condition in another table.

Something like this should work:

WITH account as
(SELECT t1.*, COUNT (*) (PARTITION BY contract) c FROM table1 t1)
SELECT * FROM account c
WHERE c = 1


OR EXISTS (SELECT 1 from table2 WHERE customer = c.customer AND type_code = "E-MAIL address");

Tags: Database

Similar Questions

  • Dynamic SQL query to get the unique value of list in a column

    I have two tables: tblWorkers and tblSkills. tblWorkers has a column, skills, which is populated by a field of multiple-checkbox with one or more skill_IDs of tblSkills, so each tblWorkers.Skills consists of a list of one or more comma-delimited values. For any Skill_ID, I need to generate a list of all workers with the appropriate skills, so I tried to do something in the direction of SELECT WorkerName FROM tblWorkers WHERE IN of skills (skills, #FORM. Skill_ID #)... or WHERE skills (ListFind (skills, #FORM. Skill_ID #))... etc.? My results (once I have had data type mismatches of the road) return all workers, not just those with the desired skills. There must be an easy way to do... How people with a little more experience CF/SQL I do this?

    > each tblWorkers.Skills consists of a list of one or more comma-delimited values

    This is your problem. You store a list of values that you want to access power/query separately in a single column. You will have to burst in a separate table.
    TblWorkers

    TblSkills

    TblWorkerSkills
    mapping table of many workers with skills.

    If you do not change your data model now, you will constantly be butting your head against that.

  • kindly tell how to use the unique value of a table with the index 0

    kindly tell how to use the unique value of a table with the index 0

    Hi
     
    Yep, use Index Array as Gerd says. Also, using the context help ( + h) and looking through the array palette will help you get an understanding of what each VI does.
     
    This is fundamental LabVIEW stuff, perhaps you'd be better spending some time going through the basics.
     
    -CC
  • Where does FireFox get the default value for a preference of. What is the format of the file that contains the default value?

    Where does FireFox get the default value for a preference of. What is the format of the file that contains the default value? I need the actual default value for an individual preference.
    Topic: config shows some default values, but I need the source from which everything: config returns to the default value.
    Any help in this direction is greatly appreciated.

    User Agent

    Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; Win64; x 64; Trident/4.0; .NET CLR 2.0.50727; SLCC2; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0)

    The preferences that are not hidden if they have by default are stored in two JavaScript text files in the Firefox program folder
    You can open them in a tab in Firefox through these links:
    resource:///defaults/pref/firefox.js
    resource:///greprefs/all.js

    (702598/forum/1/702598)

  • Get the Max values and average of the different cycles in the single channel

    Hello

    I'm trying to get the Max values and average of the single channel that has different cycles it contains. I tried to use commands such as Chnclasspeak3 and chnpeakfind, but they were not useful for me. What I need is the Max values and average of the different cycles numbers saved in the data channel.

    Exampld if the string contains 5 numbers of repetitive cycles, then we must find the maximum values and the average of these 5 cycles in the single channel. Attached reference data. This is the .raw file and I have the plugin for it to use in diadem 11.1.

    Kind regards

    X. Ignatius

    Hello, Ignatius,.

    Sorry, it took some time to provide a replacement based on the script for the function. Please take a look at the attached script. I changed the script to use my function if the tiara-version is less than 12. My script function is not as fast and more stable than the implementation of tiara, but for now, it does the job

    Andreas

  • Get the highest value of acquired data

    Hi, how can I get the highest value of data according to data acquired using the accelerometer ADXL345 and LINX in LabVIEW?

    I want the highest data to be shown with a flag. However, the data being shown are always the last acquired data. My problem would be what happens if the highest data somewhere at the beginning or in the middle of all the acquired data? How to display the highest data using an indicator?

    Here's a look at my front, block diagram, and sample of the acquired data.

    From the front panel, the basic indicator of detected last poster 0.1929 (amplitude), which is the last value. But looking at the Excel file, the highest data are data which is 0.2013. The highest, I want to be displayed on the indicator not the last value. How do I do that?

    Thank you!

    I gave you an example of what you need to do - it is not okay if wire you the new value and the old value for the X or Y - it will always return the maximum of the two values so the order doesn't matter. It would have been more useful if you had posted what you tried the max & min. You need a registry to offset inside the loop (like I did with my while loop). If you only want to display the maximum value for each iteration of the loop for external, you must initialize the shift register by plugging a 0 to its terminal on the left. A shift register her pinned the value of the last run - probably not what you want here.

  • [Labview] I want to get the average value in each new 100 samples.

    Hello. I'm Sophie.

    I'm studying Labview for my research.

    For me, the sampling frequency is 125KHz.

    I want to get the average value in each new 100 samples.

    Therefore, I want to get an average value of 1 ~ 100th samples and store this average value. Call assets(1).

    Then, I want to get an average of 101 ~ 200th samples and store this means value, call moyen2.

    .

    .

    .

    .

    I don't know how me I want.

    Thank you

    Sophie.

  • Get the current value of the variable when reaching CNVCreateSubscriber

    I use CNVCreateSubscriber () to create a subscription read to a network Variable: whenever the value of the variable changes, the DataCallback is called and I'm able to get the new value of the variable.

    But how to get the value of the variable when a subscription is created?

    I read in the help CNVCreateBufferedSubscriber () returns this information, but I wonder if using CNVGetDataFromBuffer () in a polling loop has the same performance as the approach to DataCallback of CNVCreateSubscriber ().

    In addition, the dataStatus (CNVGetDataFromBuffer) parameter is different for different Subscribers? (that is if I have multiple subscribers, CNVStaleData is related to the specific Subscriber or is a global property of the variable)?

    CNVData data;

    CNVGetConnectionAttribute (customer, CNVMostRecentDataAttribute, &data);)

  • Get the default value for class LV 1498 error

    I call get the Default Value.vi LV class to dynamically load a class.

    It was working fine until I added Open Config Data.vi to read an .ini file.

    The application works fine when I press the button RUN in the LabView development environment, but when I create the executable file with Application Builder and then run it, I get:

    "1498 error occurred getting class LV Default Value.vi"

    Possible reasons:

    LabVIEW: Library has errors. Correct the errors before performing this operation.

    «"" "String of full appeal:»»"»

    Download LV class by default Value.vi

    Test.VI

    LabVIEW has tried to load the class in this path:

    g:\cal\devices\Digital300Meter\Digital300Meter.lvclass

    I narrowed the problem down to open Config Data.vi included in the application, not in the class. I don't have to call the Open Data of Config vi to get this error.

    I have a Subvi, called "SelectDevice" which refers to Open Data from Config. In my main Test.vi SelectDevice is in the true case of a true/false case structure, which is set to False.

    If I put a design schema off around the Open Data of Config vi, I do not get the error.

    I suspect that including Open Config Data include a VI in the application that interferes with the LV ranks by default.

    Thank you, it works!

    I also put the additional Exclusions page as follows:

    Disconnect the type definitions - verified

    Remove unused polymorphic instances of VI - verified

    Remove unused libraries project - members verified

    Change the project library file after removing unused members - unaudited

  • How can I get the numeric value of a reference?

    I would like to get the numeric value of a reference.  If I look at any reference with a probe, I can see it has value, i.e. F280006B.  I would like to enter this value in a digital indicator for some troubleshooting I do. but running a Ref directly in a digital indicator introduced the code. Somehow the probe's work, it must be accessible. All advice out there?

    Type caster in U32.

    Lynn

  • Get the current value of a control of the ring

    I have a control of the ring that has the following values. See attacment. I need to get the current value of this one and use it as input for another function, but First I would like to get the current value and save ina text file. I tried this

    if (event == EVENT_LEFT_CLICK_UP) || (event == EVENT_LEFT_CLICK_DOWN)
    {
        int p;
        GetCtrlVal (panelHandle, PANEL_RINGSLIDE_1, &p);
        FILE *OutFile = fopen("C:\\Users\\Student\\Desktop\\ringtest.txt","w");
        fprintf(OutFile,p);
        fclose(OutFile);
    
    }
    

    I need to get the current value of the ring (& p) to write to the file ringtest.txt.

    Also, I need to use this value (& p) as another entry in the same program.

    IE value of & p must be used in

    b = c * 5; where c is the value of the current & p.

    Can any 1 help?

    You're right: EVENT_LEFT_CLICK_DOWN is not a valid event for the CVI. Valid events are listed in the userint.h file, and are the only events that can be caught in the trap in a point of order. On the other hand, you're assuption on EVENT_VAL_CHANGED is correct: you can trap forget the EVENT_CLICK_UP event.

    According to the second question, looking at the definition for fprintf you must pass a string format as the second parameter to the function, then the value to write to the file. In your case, the correct syntax is:

    fprintf (OutFile, "%d", p);

  • How to get the decimal value of a string of international currency

    Hi all

    How to get the decimal values to a string of international currency.

    Finally, we get to the real problem.

    You can use location functions or write your own using string functions already mentioned...

    http://developer.BlackBerry.com/native/documentation/Cascades/device_platform/internationalization/

  • get the return value of a method of the application module in the workflow

    Hello

    I use jdeveloper 11.1.1.7.0

    I defined a method (return type is useful java card) in the Module of the Application and add this method to the client interface.

    also I have a workflow and in this TF firstly I should execute this method and put the return value for the pageFlowScope parameter. I know that to use this method as a methodCall and set it as an activity by default, but I don't know how to get the return value before entering the jsff page and set the pageFlowScope parameter.

    Habib

    Concerning

    When you add the activity to the way to deal, there are 'Return value' property that you can set to #{pageFlowScope.yourVariable}

    Dario

  • When we try to create a shape with a predefined size above 10 x 10 inches of ps cs6, we get the next value in A message between 0.00 10.00 inches and thumb is necessary.  Close value inserted.

    When we try to create a shape with a predefined size above 10 x 10 inches of ps cs6, we get the next value in A message between 0.00 10.00 inches and thumb is necessary.  Close value inserted.

    You could put in your dimensions in the boxes of fixed size .

    Then just click on you document and move the object slightly before releasing the mouse if you don't get this pop up dialog box to create a Rectangle rounded.

  • How do you get the numeric value of an image

    How do you get the numeric value of an image

    This in a small example

    var Red = ' \u00FF\u00D8\u00FF\u00E1\x05oExif\x00\x00MM\ '.



    Here is a link to a script open source that generates a string that represents the data of a file binary, especially useful to integrate a small image in a script or file patterns in a JSON structure, for example:

    Get the data from binary string

    HTH,

    Domestic-

Maybe you are looking for

  • F5/F55 SDI

    I have not seen information on the HD - SDI output on both devices. The only thing published so far is that only F55 will output 4-Channel HD to 4 k. I hope that both cameras will show 4:4:4 Slog2 through the SDI, recorders so 3rd party can be used

  • A WiFi limited access on Satellite A200

    Hello everyone I have a Toshiba Satellite A200-1IW I installed windows 7 and put to update to service pack 1 about 5/6 months ago. It has worked flawlessly since. However, since last week the wifi connection is underway at limited access connectivity

  • my printer ink system, says failure oxc19a0023

    My printer HP officejet 4622 there is not an ink cartridge latch handle, so I can't clean the print head. The Oxc19a0042 error is still on display. I turned the printer market several times and installed a new HP ink cartridges, but nothing has chang

  • Please check the lot number

    It comes to prank my friends. his other orders programs that do the same thing just starting I couldve done one but good what the * im bored: program main P: @echo off echo echo RapidJaws presents echo _ Killing Floor Patch: pathping Killingfloor.exe

  • loyal customer lost, bad customer Service

    Hello, my name is Patrick Absher, a loyal customer of Motorola for many year. When I say loyal, I'm the guy who's always telling my friends, family and colleagues how are my products from Motorola. Pagers to the bottom when, and now cell phones, almo