return the same value defined in a group.

All,
I have the below requirement,

I had a table (deptid, deptname, address, city, zip, State, other columns) I want to write a query to determine any errors (records with different values) because I expect all records grouped by(deptid, deptname, address,city,zip, state) to have the same deptid (Please note that deptid is not unique).

or a specific deptid should have only one record based on the groupping (deptid, deptname, address, city, State, zip).

any suggestion? Thank you.

One way to check is to check for a Unique Deptid deptname combination, address, city, zip, State;

In this way, you will get all the combination deptname, address, city, zip, Associate State with more than 1 dept_id. However, if one of these have different value, then you are bound to get several lines and thus false positives.

select deptname, address,city,zip, state, count(distinct dept_id)
  from dept_table
group by deptname, address,city,zip, state
having count(distinct dept_id) > 1

How about you, you give us the structure of the Table and a few examples of data as well as the expected release of him. It will help us giving you the good request that fits your needs.

Tags: Database

Similar Questions

  • : Nom_element and V ('ITEM_NAME') do not return the same value

    Hi all

    I'm developing a shared application process that is called by an AJAX request.

    For the pl/sql code, stored procedure validation e development support I moved the logic inside a database.
    So I have this situation:

    Application process

    ...
    : MYITEM: = wwv_flow.g_x01; -received setting of ajax call I want to put
    ...
    MY_FUNCTION();

    MyFunc

    ...
    v('MYITEM') - here I use value MyItem
    ...

    The problem is that when I call v ('MYITEM') the value I get is the previous and not one that I put with: MYITEM: = wwv_flow.g_x01;
    I have the same problem if I set the V ('MYITEM') inside the apex application process.

    I saw that it worked right if I use the following to set the value of the element in the application process:

    APEX_UTIL. SET_SESSION_STATE('P0_LST_DATA',:P0_LST_DATA);

    Is this a bug?
    I was expecting to get the value of the item: MONELEMENT and v ('MYITEM') are equivalent...

    Thank you
    Davide

    Davide,

    If you encode the block like that, you should get the results you expect:

    : P100_VAR1: = '1'. : P100_VAR1;
    : P100_TEST: =: P100_VAR1;

    The reason why this block does not give you what you expect:

    : P100_VAR1: = '1'. : P100_VAR1;
    : P100_TEST: = v ('P100_VAR1');

    ... is that v ('P100_VAR1') returns the current value of the item in the table of PL/SQL State session as it existed before the execution of the block. The assignment to the variable binding: P100_VAR1 has registered only a value in storage variable to bind the dynamic execution at this time and has not yet spread to session state, which is located at the end of the execution of the block. It's a little weird, we know.

    Andy,

    I figured that the: xxxx points have been settled during the loading of the page with what the source is...

    They contain the session state value and can be read or written in notation variable bind.

    However, they are updated only in the session when you send page...

    They are updated in session state when the particular block is completed and a commit is issued at this time there.

    In order to update a piece of code PL/SQL session state, you must use... apex_util.set_session_state.

    You must be careful to call it when scoring also bind variable to set the session state may cause one to deny the other. Using one method or the other should work very well.

    Scott

  • Subquery returns the same value but no returnet lines

    HY all

    First of all excuse me for my English. I know that is very bad.

    I have a very annoying problem...

    I habe a query like this

    Select the car of cars where car_color = (select color color where car_id = '5452')

    My real Qery is mor complicated, but this is how it works.

    Now the problem:

    If I run the first query select car of cars where car_color = 'black' the query returns a value.

    If I run the subquery *(select color from Colors where car_id ='5452') * the subquery returns a value (black)

    If I run the query and subquery select car of cars where car_color = (select color color where car_id = '5452')
    I get no value :(

    How this bee? If I take the (black) result of the subquery, and paste of STIs in the first request, then I get a value.
    But if I use the two querys it works.

    Thank you for your support

    Welcomes Burillo

    user13568585 wrote:

    I can see that the results are not the same, but how can it happen?
    Without your thing, I'll never be able to see the problem. Toad is really stupid as I think?

    It has nothing to do with the toad. You will get the same results in SQL * more. Most of the tools on the client side display the nonprinting characters such as spaces. And in your case, string returned by the subquery has had new line at the end. Anyway, the other way to understand would compare dumps of returned strings:

    select DUMP(LTRIM(RTRIM(rem.PSTREM_KURZ_BEZ))) from p_pveps_episode eps,  p_pvrep_re rep, p_strem_rechempf rem
    WHERE
    eps.allmnd_mandant='Test' and
    eps.ppveps_aufnr='101224' and
    eps.allmnd_mandant=rep.allmnd_mandant and
    eps.ppveps_epsnr=rep.ppveps_epsnr and rep.pstrem_ident=rem.pstrem_ident -- {and ltrim(rtrim(rem.PSTREM_KURZ_BEZ)) =} quotet to show result
    

    SY.

  • decrypt not returns the same value that encrypt

    Hi all
    Please help if you have encountered this problem before or have any brilliant suggestion to my question below.

    I try to encrypt the value "4120166668", insert in the database, and then decipher that it appears on the system. It seems that the value "4120166669" appears. Build an example of code that is not complete database, and it still does not work.

    But if I exert the ToBase64() function then encrypt, as well as decrypt and then run tostring (tobinary ()), it works. The thing is, if I change that, the rest of encryption is stored in the database will have error when the display on the system because it uses the same encrypt and decrypt the value.

    How should I go about this? Does anyone have suggestions or other ways? And I really want to know what causes this problem to occur.

    See you soon,.
    Jamie

    delete the part of the encrypted value (chr 10/newline at the end of the value). Delete this Trim() and you can convert without problem.

    CR

  • NotificationsDialog returns the same value for the two buttons

    I have a NotificationsDialog with two SystemUiButtons, now when I click on buttons and console the result they both return the number two, I don't really understand why.

    {NotificationDialog}
    ID: alertdialog
    Title: "Alarm" - + alarmTime
    body: Setting.get ("alarmCompletedMessage")
    repeat: true
                
                    
    buttons:]
    {SystemUiButton}
    label: "Stop".
    },
    {SystemUiButton}
    label: "Snooze."
    }
    ]
    onFinished: {}
    Console.log ('result' + result)
    Console.log (Error)
    }
    }

    Is there a better way to identify which button has been activated?

    Wish a little, she supported confirm and Cancel buttons, or SystemUIButtons have their own onClicked properties

    Thank you

    Use buttonSelection () instead of the result .label

  • Mosaic Georaster does not return the same values as sources

    I have created a mosaic using the plsql block... and when you query the source and the mosaic I get different results...

    Any suggestions...

    Best regards

    Tagle Hugo

    -PLSQL

    DECLARE

    GR sdo_georaster;

    BEGIN

    INSERT INTO NED_MOSAIC (id, rast)

    VALUES (1, sdo_geor.init ('NED_MOSAIC_RDT'))

    RETURN rast IN gr.

    sdo_geor. Mosaic ("ned", "rast", gr, 'block size = (1024, 1024)', sdo_number_array(-100));

    UPDATE ned_mosaic SET rast = gr WHERE id = 1;

    END;

    /

    -QUERIES

    SELECT 'source' x, sdo_geor.getCellCoordinate (rast, 0, sdo_geometry (2001,4326, SDO_POINT (-80.290818, 25.753106, null), null, null)) cells.

    SDO_GEOR.getCellValue (rast, 5, SDO_GEOMETRY (2001, 4326, SDO_POINT (-80.290818, 25.753106, NULL), NULL, NULL), 1) elevation

    OF rm_ent.ned

    ---

    WHERE ned_ref_id IN (SELECT ned_ref_id FROM rm_ent.ned_ref

    WHERE sdo_relate (geom, SDO_GEOMETRY (2001, 4326, SDO_POINT (-80.290818, 25.753106, NULL), NULL, NULL), "mask = ANYINTERACT'") = "TRUE" ROWNUM AND < 2) AND ROWNUM < 2

    ;

    SELECT 'mosaic' x, sdo_geor.getCellCoordinate (rast, 0, sdo_geometry (2001,4326, SDO_POINT (-80.290818, 25.753106, null), null, null)) cells.

    SDO_GEOR.getCellValue (rast, 5, SDO_GEOMETRY (2001, 4326, SDO_POINT (-80.290818, 25.753106, NULL), NULL, NULL), 1) elevation

    OF rm_ent.ned_mosaic;

    -RESULTS

    X CELLS RISE

    ------ ----------------------------------------------------- --------------

    source MDSYS. SDO_NUMBER_ARRAY (2666,7659) 2.79998779

    X CELLS RISE

    ------ --------------------------------------------------------------------

    Mosiac MDSYS. SDO_NUMBER_ARRAY (35066,29259) 2.6000061

    Hi Hugo, you check the values of the cells on level 5 of the pyramid. You can check the original cell values to see what is happening?

    That is to say, change SDO_GEOR.getCellValue (rast, 5, SDO_GEOMETRY (...

    to SDO_GEOR.getCellValue (rast, 0, SDO_GEOMETRY (...

  • CFQUERY returns always the same value

    < name cfquery = "qryGetMAXID" datasource = "#Request.DSN #" >

    SELECT

    MAX (FLEET_CON_ID) + 1 as MaxFleetId

    Of

    CONFIGURATION

    < / cfquery >

    < cfset intFLEET_CON_ID = #qryGetMAXID.MaxFleetId #/ >

    < name cfquery = "qryAddOperator" datasource = "" #Request.DSN # "result = 'test' >"

    INSERT INTO

    CONFIGURATION

    (FLEET_CON_ID,

    COL2,

    COL3,

    COL4)

    VALUES

    (#intFLEET_CON_ID #,)

    "ADD OPERATOR."

    "#strCode, #

    ("#strName #")

    < / cfquery >

    the qryGETMAXID query always returns the same value as 18703. I inserted a few values in the database directly. the query should return 18705. When I run the same query in SQL Developer, it returns the correct value. I've not cached the query.

    Please help me.

    Thanks in advance

    Dan and Wolfshade,

    Thanks for the problem.

    I found the problem, then that I insert into the database, I didn't do it. He was thus the same value.

    Sorry...

  • Satellite P300-156 - and the button Return give the same values

    Hello

    I have a satellite P300-156, and it has a numeric keypad.
    I have problems because the Enter key and the Return key give the same values. I believe that it is incorrect.
    Can anyone help.

    Key on the numeric keypad should give an input it does.
    the Enter key on the main keyboard should give a carriage return value, but it gives an input value.

    Usually this does not cause a problem, but with software like photo shop that makes the distinction between a carriage return and a hard fall it does not work.

    Can someone help me please

    Thank you

    Hello

    To my eyes the entry and return keys are the same keys that provides the same functionality.
    I really put t know why you believe that there is something not right

    By the way; Check if you are using the latest version of the BIOS!

  • inputText and ouputText does not display the same value

    Hello

    JDev 11.1.2.4

    On my page, I have an inputText and outputText bound to the same link of the attribute. The bind value is defined in a value change listener, and then the two components are updated. Say I put in 2009 for the PeriodFrom, the inputText remains empty, but the outputText shows the 2009. How is possible that the two items related to the same link does not show the same value.

    < af:inputText value = "#{bindings." PeriodFrom.inputValue}"required =" #{bindings. " PeriodFrom.hints.mandatory}.

    columns = "#{bindings." PeriodFrom.hints.displayWidth}"shortDesc =" #{bindings. " PeriodFrom.hints.tooltip}"id ="id1 ".

    autoSubmit = "true" simple = "true" >

    < f: validator binding = "#{bindings." PeriodFrom.validator} "/ >"

    < / af:inputText >

    < af:outputText value = "#{bindings." PeriodFrom.inputValue}"id ="ot3"clientComponent ="true"/ >

    Furthermore, I tried to get the RichInputText component and call a getValue on it, and the value returned is 2009. I'm completely lost.

    Thank you

    I made the fragment of page from scratch. I discovered why the update does not work. This is because the selectOneChoice is inside an af:subform. If I remove the subform, the update works correctly.

    shortDesc = "#{bindings." StdcntyCode.hints.tooltip}"id ="soc2"simple ="true"autoSubmit = 'true '.

    valueChangeListener = "#{pageFlowScope.identificationSessionEditBean.countryValueChangeListener}" > "

    columns = "#{bindings." PeriodFrom.hints.displayWidth}"shortDesc =" #{bindings. " PeriodFrom.hints.tooltip}"id ="id1 ".

    autoSubmit = "true" simple = "true" >

    columns = "#{bindings." PeriodTo.hints.displayWidth}"shortDesc =" #{bindings. " PeriodTo.hints.tooltip}"id ="id2 ".

    autoSubmit = "true" simple = "true" >

  • Need to show the same values in all jspx pages

    Hello.

    I use jdeveloper 11.1.1.5

    I had created a jspx pages such as dept.jspx and emp.jspx

    I've been using this in my jspx page
     <af:outputText value="#{bindings.return.inputValue}"
                               binding="#{pageFlowScope.backing_dept.ot1}"
                               id="ot1"/>
    The bindings.return.inputValue will return the value of the code below
        public String checkLoginCredentials1(String p_user,String p_pwd)
        {
        System.out.println(p_user + " " + p_pwd);
         ApplUsersVOImpl  vo = (ApplUsersVOImpl)this.getApplUsers1();
         /*set the bind variable value*/
        vo.setNamedWhereClauseParam("p_user",p_user.toUpperCase());
        vo.setNamedWhereClauseParam("p_pwd",p_pwd.toUpperCase());
        vo.executeQuery();
        int rowCount=vo.getEstimatedRangePageCount();
        System.out.println("rowCount="+rowCount);
        if(rowCount==0) 
        { 
           throw new JboException("Password doesn't match");
         }
           return "Welcome"+ "  " + p_user.toUpperCase();
        } 
    My scenario is that I need to display the same value in emp.jspx

    I had created a task flow frm dept.jspx to emp.jspx and emp.jspx to dept.jspx

    I tried the same XML file in my emp.jspx
    <af:outputText value="#{bindings.return.inputValue}"
                               binding="#{pageFlowScope.backing_emp.ot1}"
                               id="ot1"/>
    But while I m browsing frm emp.jspx to dept.jspx there are doesnot.,.

    This means that for the faces-config. XML (the standard JSF configuration file), there is no scope spanning application except for the scope of the session. This does not mean that you should not use extended session if you use faces - config.Xml.

    However, you have been advised to use the workflow and no faces - config.Xml.

  • Question of value Popup Lov key (description of the poster, returns the key value) by default

    Hello

    I have a Popup Lov key (description of the poster, returns the key value) and I want a default value. It is based on a list (user name, id).
    I tried to put the id of the user logged on as default, but what I see on the screen in the field is the value of the id, not the username.
    How can I pass the user id and see the user name?

    Thank you.

    Oh! My bad, I thought you are talking about regualt lOVs not popups.

    OK, so that's what you need to do, I tried it and it worked for me:

    your popup LOV > default > type: body of the PLSQL function > and enter a query like:

    declare
    UID number.
    Start
    Select user_id from the uid of the user
    where UPPER (username) = UPPER(:APP_USER);

    This should show username and retune userid.

    Hope this helps,

    Sam
    Please give good answers by marking correct or useful.

  • All channels to HAVE it have the same value

    I use the example for a multichannel AI aiex2.cpp read with mseries NI6280 devices.

    This example works for a lane, but other chains have the same value

    For example: I put 5 Volt on the first string, and then the other channel are 5 Volt too.

    What should I consider in the configuration?

    Hello Beilei,

    I think that you run in theghost of the question.  The other strings that you use are connected to the earth when you connect the first channel to 5V?  If the other channels are floating, they will read the same value as the first string... 5V.

    Steven T.

  • All channels to HAVE it have the same value - NI PCI-6221 and NI PCI-6229

    Hello

    I use the aiex1.cpp example for a multi-channel read with the devices mseries 6221 and 6229.

    This example works for a lane, but other chains have the same value (difference of +-0.001 Volt).

    For example: I put 5 Volt on the first string, and then the other channel are 5 Volt too.

    What should I consider in the configuration?

    Heiko Hello!

    your description looks like the effect you are having 'ghosts '.

    For more information about ghost images and how to get rid of, check out these links:

    http://digital.NI.com/public.nsf/allkb/73CB0FB296814E2286256FFD00028DDF?OpenDocument

    and

    http://digital.NI.com/public.nsf/allkb/C6C7DE575301A379862572DD00480A01?OpenDocument

    Best regards

    Moritz M.

  • Only GET records that have the same values of field has the same value in field B

    Have a hard time with below, please help.

    Here's the situation:

    create table cord (identification NUMBER, CM VARCHAR2 (3), PM VARCHAR2 (2));
    insert into string values (1, '002', 'H1');
    insert into string values (2, '006', 'H1');
    insert into string values (3, '004', 'H2');
    insert into string values (4, '006', 'H2');
    insert into string values (5, '004', 'H3');
    insert into string values (6, '004', 'H3');

    I just need to select the folders which, for the SAME value of PM have the same value in CM, in example above, those are recordings with ID (5,6).

    1 and 2 fail because for them CM and PM are different for the same H1, similar on the 3 and 4.

    I don't know if this will help but records are always in 'pairs', which means that there are no cases as

    7. '004' | H4

    8. ' 006' | H4

    9. '005' | H4

    Any ideas are much appreciated.

    Thank you

    See if the following can help...

    select id,cm,pm
        from(
            select t.*
                  ,count(1) over(partition by cm,pm) cnt
                from testt t
            )
        where cnt>1;
    
  • get the index of the same values in table

    Hi guys,.

    I'm trying to get the index of array elements with the same value but it can solve mine.

    my case is:


    array1 = [1,2,3,4]; <-here are the names of the pages, always in the order of CSA (these table I used only to check the results of my work, probably will not be for you but maybe...)

    array2 = [1,1,2,2,2,3,4,4,4]; <-these numbers are random, but always in the CSA order (these are the names of pages for items in table 3)

    array3 = [a, b, g, i, f, e, c, h, d]; <-these are all the values of the elements I want to work with later. number of articles is still the same as in array2, their indexes are corresponding.

    array4 = [];

    I need to remove array3 everything, but one of each issue of array2 (as I will remove duplicates) or push to array4 an article of array3 for each number of the array array2 (as I'm going to ignore duplicates)

    don't know is my desc is clear enough, but the result I get is:

    ex. [a, g, e, c]

    above example for each number of array2 array3 items, but do not have to be first, can be second or third if etc exist, but have to be alone.

    I thought that if I get duplicate values, the index in the array array2 and delete this index in array3 will get what I want, but can not solve.

    You will appreciate all help.

    Thank you

    Try something like this:

    var array2 = [1,1,2,2,2,3,4,4,4];
    var array3 = ["a","b","g","i","f","e","c","h","d"];
    
    var tempArray = [];
    var resultArray = [];
    var n , x ;
    
    for(var n=array2.length-1;n>=0;n--)
    {
        var string = ""+array2[n];
        tempArray[string] = array3[n];
    }
    
    for(x in tempArray)
    {
        resultArray.push(tempArray[x]);
    }
    
    resultArray.reverse();
    // a,g,e,c
    

    Hope, that helps.

    Uwe

Maybe you are looking for

  • OfficeJet Pro 6835: Receiving user Intervention required status, when I try to print something

    I just installed my new printer to two computers, works perfectly on my Toshiba laptop running windows 7. However, when you try to print from my Dell windows 8.1 laptop I keep receiver a message saying "required user Intervention." I tried uninstalli

  • Generation of QR code in offline mode

    Hello everyone. I want to help to generate a QR code in offline mode. Yes, I did try to generate a QR code using labview but when am online. I'm able to generate the qr code. I will attach my VI below for the online. Some1 can help me please.

  • User RDS CAL

    Hello How 'user Cal RDS' do I need if want to connect to the same user from multiple devices at the same time? Thank you.

  • Get all apps

    How can I get all applications installed in my BB? Is there a api is available to perform this task? If so can give no matter what the class and the method. With regard to: Jitendra.Balla

  • Installation of Oracle Fusion Middleware, forms and reports 11g Release 2 (11.1.2.2.0)

    Hi allRHEL 6.5I want to install forms/States 11 g (after installing weblogic)I'm on step 15 of 16 when I encountered errorHelp, please. Thank you.The error log is shown below:getDomainRuntimeMBeanServerConnection...Connecting to the DURATION field...