using 'like' in the group record query

Hello

(Forms 6i)
I dynamically create a record group.

Then to when a new trigger for a list item.
I want to list all the names of a table like 'a % ';

query: select name, id (id) to_char of test_name where name like 'a % ';

but I'm not able to give a quote unique in the query.
Is it possible to do?

Published by: Tuts009 on May 9, 2010 01:38

In order to use it in this way:

str := :list4||'%';
rg_id := Create_Group_From_Query( rg_name,
                           'SELECT name,to_char(id) id from test_name where name like ''' || str || '''');

Tags: Oracle Development

Similar Questions

  • Database adapter: how to make queries that use LIKE with the %

    Hello! I'm sure this has already been answered somewhere, but the forum search ignores characters like '%', so I was unable to find.

    I can't understand how a query using % using the jdeveloper database adapters.

    I tried a number of variations of

    SELECT id, name FROM testtable WHERE name like '%' + #nameParam + '% '.

    But I get a 'not a number' error, because it seems that he do not concatenate strings but try to add as numbers :(

    Can someone help me please?

    Ruben,

    Have you tried to use the ANSI string concatenation operator.

    You can also try the forums SOA Suite or BPEL, as there are probably more people who understand what you're asking here.

    John

  • Apex 5, user "Is in the group" works for authorization seems to not work

    Hello team Apex,

    Apex 5

    I would use the construction Type of plan (user) "Is in the group" authorization feature, but it seems to not work.

    The user is in the group but nevertheless is not allowed.

    I checked this with "& APP_ALIAS. ' in the group element - that's how I would use it - and the Group static 'true' name too.

    (We have a group for all applications, where the group name is the same name of the App - just to understand the call below.)

    When I use it to place a further authorization scheme with "PL/SQL function body:

    Return apex_util.current_user_in_group (v ('APP_ALIAS'));

    -It works as expected.

    Can you please verify this?

    Thank you in advance!

    Concerning

    André

    Hi Andre,

    What type of authentication scheme you use? Because, according to the text of the authorization scheme aid groups will be just picked up for the authentication of the account of the APEX.

    • Group: enter a group name. Authorization succeeds if the group is activated as a dynamic group for the session (see APEX_AUTHORIZATION. ENABLE_DYNAMIC_GROUPS). If the application uses authentication to accounts Express request, this check also includes workspace groups that are granted to the user. If database authentication is used, this check also includes database roles that are granted to the user.

    I just tried "Is in the group" and had no problem to check my groups.

    BTW, in your PL/SQL code, there is no need to use the function of V, just use bind variables as syntax: APP_ALIAS

    Concerning

    Patrick

  • Using the function count with grouped records

    Hi all

    This seems like it should be very easy, but I still have to find a simple way to do it.

    Suppose I want to count the possibilities which are grouped by Sales Rep at run time I filter this list with a parameter for sales stage and created date.
    I've simplified this greatly, but here's what my setup looks like now:

    Sales representative*-Count* _
    <? for-each-group: opportunity [SalesStage = param1 and creation > param2]; /SalesRep? >
    <? SalesRep? >-<? count (current - group (available))? >
    <? end for each group -? >
    _ Total

    The only solution I have to get my grand total so far is to create a variable and permanently keep a total that I will then display in the Total column. It all works, it seems that there should be an easier way, want to do a simple count (Id) for a total general. But given that the Total amount will appear after the end of each group-, I lose the filter that has been applied to the group so that the count is not valid.

    Ideas of the experts?
    Thank you!

    To get the total general
    use

    param2]/Id)?>
    

    Since you have not mentioned the complete xml code, I assumed, as the root.
    If this isn't the case, put the full path from the root.

    If you give some xml examples and explain the output you want, we can fix it immediately.

    go through these too... something can be drawn from here.
    http://winrichman.blogspot.com/search/label/summation%20In%20BIP
    http://winrichman.blogspot.com/search/label/BIP%20Vertical%20sum

  • Move to the record of the groups now

    I work in form 11g and using the webUtil version that was included with it. I just do my development by remoteing directly on the server because it is easier that develop on my computer the compilation and then sending to the server and then compile again until I can use it and the server runs on Windows Server 2003 SP2.

    For those of you who have not until this follow-up to my posts, I'm working on the use of webUtil to create buttons to upload/download on one of the forms of our program. I FINALLY got webUtil set up and got the part of download works now I am trying to enter the download, I try firstly set up a way to show the user which was transferred to the table (not the actual blob or anything like that just the document filename ID etc) so they can select which file they want to download it to their computer , I tried to do this as well by creating a drop-down list and put the ID doc in that and also just by clicking on the button and pulling it upward a LOV the user to pic and in both cases he works not. The problem, I am running, at least for now, is that somehow it is not able to fill the record, I know that, I just can't understand what may not be correct with the record group... the only properties in the record group is the name of it, the query that fills the size of the extraction and the columns, the query throws an error as soon as you click on that property if there is nothing wrong with that, columns are practically filled auto of forms and the size of the extraction I tried almost all values between 0 and 100, nothing helps.

    The query I use is:

    SELECT ANNUAL, FILENAME
    DOCUMENTATION
    WHERE ANNUAL IS NOT NULL
    ORDER BY ANNUAL CSA

    but when I try to run the program I get a FRM 41076: error group filling. Followed by a FRM 40502: ORACLE error: cannot read the list of values. Of course, he cannot read the list of values there is no value to read because the record group has not been filled.

    Please any help on this is greatly appreciated. The wonderful people of this forum have been absolute rescuers so far on my quest to get this program to work despite the better to keep me from succeeding.
    SELECT DOC_ID, FILENAME
    

    DOCUMENTATION
    WHERE ANNUAL IS NOT NULL
    ORDER BY ANNUAL CSA

    What happens when you run your query more SQL, TOAD, etc.?

    Your table is created in the schema JLIM. This user are you connected to forms with? If it is not the user JLIM, then you will need to reference the table in your query using the schema owner. FOR EXAMPLE:

    SELECT DOC_ID, FILENAME
    FROM jlim.DOCS
    WHERE DOC_ID IS NOT NULL
    ORDER BY DOC_ID ASC
    

    If this table will be used frequently by your form application, you can eliminate the need to fully qualify your table by creating a public synonym to the table.

    Hope this helps,
    Craig B-)

    If someone useful or appropriate, please mark accordingly.

  • Using syntax for the 'If' statement in the query?

    Hi, I work at the end before the PS 9.2 via the request handler and need help

    What I want to do, it's a field of expression to create
    another field of expression that I can use to group on. Maybe the query like
    expressions based on expressions...? Maybe because I'm on an Oracle database, I need to use Decode? If so, how can I use decode?

    Details:

    The field I created Gets the length of the employee in
    service and it works very well

    MONTHS_BETWEEN (SYSDATE, A.SERVICE_DT) / 12

    It works as a character or a numeric field.

    This is the problem... The next field, I would like that the query is one that goes like this...

    IF ((MONTHS_BETWEEN(SYSDATE,A.SERVICE_DT)/12))
    < = 4.99, "minus 5"

    ELSE IF ((MONTHS_BETWEEN(SYSDATE,A.SERVICE_DT)/12)) > = 5 AND
    ((MONTHS_BETWEEN(SYSYDATE,A.SERVICE_DT)/12)) < = 9.99, "5 to 9".

    ELSE IF ((MONTHS_BETWEEN(SYSDATE,A.SERVICE_DT)/12)) > = 10 AND
    ((MONTHS_BETWEEN(SYSYDATE,A.SERVICE_DT)/12)) < = 14.99, '10 to 14', "15 and"
    More»

    I get an error message that "a SQL error has occurred. For more details, please see your system log. Error in running because the SQL query is 972. Message = ORA-00972 identifier is too long (50 380)

    Can you tell me what expression should I use? And please keep in mind that I do not have access to the SQL Developer, so I have to use the query. Thank you!... Mary



    I would recommend using BOX WHEN if you're on an Oracle database.  Something like:

    CASE WHEN ((MONTHS_BETWEEN(SYSDATE,A.SERVICE_DT)/12)) <=4.99 then="" 'less="" than="" 5'="" when="" ((months_between(sysdate,a.service_dt)/12))="">= 5 AND

    ((MONTHS_BETWEEN(SYSDATE,A.SERVICE_DT)/12)) <=9.99 then="" '5="" to="" 9'="" when="" ((months_between(sysdate,a.service_dt)/12))="">= 10 AND ((MONTHS_BETWEEN(SYSDATE,A.SERVICE_DT)/12))<=14.99 then="" '10="" to="" 14'="" else="" '15="" and="" over'="">

    You can find more on the syntax of the CASE on the Oracle's Web site:

    http://docs.Oracle.com/CD/B19306_01/AppDev.102/b14261/case_statement.htm

  • FILL MONTHS DYNAMICALLY IN THE ITEM VIA ORACLE FORMS GROUP RECORDING LIST

    Experts

    I have a query in oracle forms. I need to fill Last_Month, Current_Month & Next_month based on Sys_Date in the list box. I am able to get the values in SQL if I run the query below, but when I use the version of Oracle Forms 10.1.2.0.2, I could not get the values of Mr. can you please guide me where I'm wrong.

    declare

    v_rg_id recordgroup: = NULL;

    Number of V_errorcode;

    v_rg_salmth varchar2 (30): = "MONTHS";

    Begin

    v_rg_id: = find_group (v_rg_salmth);

    If id_null (v_rg_id) then

    v_rg_id: = create_group_from_query (v_rg_salmth,

    "WITH (AS MONTH_COUNTER)

    SELECT LEVEL 2 AS ID

    OF THE DOUBLE

    CONNECT BY LEVEL = 2

    UNION

    SELECT LEVEL AS ID

    OF THE DOUBLE

    CONNECT BY LEVEL = 0

    )

    SELECT TO_CHAR (ADD_MONTHS (TO_CHAR (SYSDATE), ID), MONTH) AS MONTH_COUNTER MONTHS ');

    v_errorcode: = populate_group (v_rg_id);

    If v_errorcode = 0 then

    message ("record group filled with data");

    on the other

    message ("V_errorcode is:" | ") v_errorcode);

    end if;

    End if;

    populate_list('MASTER.) MONTH, v_rg_id);

    end;

    The rather complicated query, try

    SELECT ADD_MONTHS (SYSDATE-1) TO DOUBLE

    UNION ALL

    SELECT SYSDATE DOUBLE

    UNION ALL

    SELECT THE DOUBLE ADD_MONTHS(SYSDATE,1)

    BTW. to use a query to populate a list, you must select two values, a label and a value, check it fill listitems dynamically - Andreas Weiden - on Oracle

  • analytical query to select the next record

    Hi all
    I would like to ask the two table below correspond to the output.
    1.dev_wt 2.dev_map 3. output result

    To help more clearance, please see this image link: http://lh6.ggpht.com/_xL6eBqjW6Yo/TEqnSvlF_FI/AAAAAAAAB0U/i2sclnnaj6g/Untitled-3.jpg

    1 dev_wt
    PMS_COMP     PMS_I       PMS_PERF_D   PMS_WT   PMS_CREATION_D
    BBOARD     GICEQGROSS    04/01/2001     30     04/05/2001
    BBOARD     GICST_B       04/01/2001     5      04/05/2001
    BBOARD     SBGS_B        04/01/2001     65     04/05/2001
    
    BBOARD     GICEQGROSS    04/11/2001     30     04/15/2001
    BBOARD     GICST_B       04/11/2001     5      04/15/2001
    BBOARD     SBGS_B        04/11/2001     65     04/15/2001
    2 dev_map
    GS_CODE     GS_I_CODE    GS_I_ID  MD_ID   GS_START_DT    GS_END_DT
    GICEQGROSS   CIWL        304       15     01/04/1998     31/03/2004
    GICEQGROSS   CIWL        304       2     01/04/2004      31/03/9998
    GICST_B      GICST_B     3707      15     01/04/2000     31/12/9998
    SBGS_B       SBGS_B      2231      15     01/04/1992     30/09/2003
    SBGS_B       SBGS_B      564       15     01/10/2003     31/12/9998
    I would like to match PMS_I = GS_CODE to retrieve the GS_I_CODE and analytical assistance

    query to search for the next record.
    Because I need to select record GICEQGROSS PMS_PERF_D date and following
    GICEQGROSS save PMS_PERF_D of dev_wt table and put the result GS_WT_FR and GS_WT_TO output.

    The date is in the format YYYYMMDD
    PMS_WT is divided by 100

    * 3. Output result *.
    GS_I_ID    PMS_COMP     GS_I_CODE     GS_WT_FR     GS_WT_TO     GS_I_CALC
    304       BBOARD        CIWL          20010401     20010410     0.3
    3707      BBOARD        GICST_B       20010401     20010410     0.05
    5209      BBOARD        SBGS_B        20010401     20010410     0.65
    PMS_COMP is of dev_wt table
    GS_I_CODE is dev_map join of tables with dev_wt
    GS_WT_FR is dev_wt GS_START_DT table
    GS_WT_TO's dev_wt record table according GS_START_DT where PMS_I = 'GICEQGROSS. '

    Now my challenge is to select the next record in PMS_PERF_D using the query analysis. Below
    is my query...
    SELECT GS_I_ID, PMS_COMP, GS_I_CODE, GS_WT_FR, GS_WT_TO, GS_I_CALC
    FROM dev_wt (
     SELECT lead(PMS_PERF_D) over(partition by PMS_I order by PMS_PERF_D) as GS_WT_TO        
     FROM dev_wt where PMS_I ='GICEQGROSS')
    left join dev_map on PMS_I = GS_CODE ;
    Thank you

    Edited by: WinZone 24 July 2010 16:46

    Edited by: WinZone 24 July 2010 16:50

    Hello

    This should be good:

    SELECT DISTINCT t2.gs_i_id, pms_comp, t2.gs_i_code,
                    TO_CHAR
                       (MIN (pms_perf_d) OVER (PARTITION BY pms_comp, pms_i),
                        'yyyymmdd'
                       ) gs_wt_fr,
                    TO_CHAR
                       (MAX (pms_perf_d) OVER (PARTITION BY pms_comp, pms_i) - 1,
                        'yyyymmdd'
                       ) gs_wt_to,
                    pms_wt / 100 gs_i_calc
               FROM dev_wt t1, dev_map t2
              WHERE t2.gs_code = t1.pms_i
    

    REM note even as odie: should be "2231" instead...

  • Need help in the optimization of the query with the Group and joins by clause

    I'm having the problem by running the following query... It takes a lot of time. To simplify, I added the two tables FILE_STATUS = stores the file load details and COMM table Board table job showing records treated successfully and which was communicated to the other system real. Records with status = T is trasnmitted to another system and traansactions with P is waiting.
    CREATE TABLE FILE_STATUS
    (FILE_ID VARCHAR2(14),
    FILE_NAME VARCHAR2(20),
    CARR_CD VARCHAR2(5),
    TOT_REC NUMBER,
    TOT_SUCC NUMBER);
    
    CREATE TABLE COMM
    (SRC_FILE_ID VARCHAR2(14),
    REC_ID NUMBER,
    STATUS CHAR(1));
    
    INSERT INTO FILE_STATUS VALUES ('12345678', 'CM_LIBM.TXT', 'LIBM', 5, 4);
    INSERT INTO FILE_STATUS VALUES ('12345679', 'CM_HIPNT.TXT', 'HIPNT', 4, 0);
    
    INSERT INTO COMM VALUES ('12345678', 1, 'T');
    INSERT INTO COMM VALUES ('12345678', 3, 'T');
    INSERT INTO COMM VALUES ('12345678', 4, 'P');
    INSERT INTO COMM VALUES ('12345678', 5, 'P');
    COMMIT;
    Here's the query I wrote to give me the details of the file that has been loaded into the system. He reads the table of State and the commission files to display the name of the file, total records loaded, total at the table of the commission and the number of records which has finally been passed successfully loaded (Status = T) with other systems.
    SELECT 
        FS.CARR_CD 
        ,FS.FILE_NAME 
        ,FS.FILE_ID
        ,FS.TOT_REC
        ,FS.TOT_SUCC
        ,NVL(C.TOT_TRANS, 0) TOT_TRANS
    FROM FILE_STATUS FS
    LEFT JOIN
    (
        SELECT SRC_FILE_ID, COUNT(*) TOT_TRANS
        FROM COMM
        WHERE STATUS = 'T'
        GROUP BY SRC_FILE_ID
    ) C ON C.SRC_FILE_ID = FS.FILE_ID
    WHERE FILE_ID = '12345678';
    In production, this request has several joins and takes a long time to deal with... the main culprit for me is the join on the COMM table to count the number of number of transactions sent. Please can you give me tips to optimize this query to get results faster? What I need to delete the Group and use the partition or something else. Help, please!

    Don't know if it will be faster based on the information provided, but analytical functions offer an alternative approach;

    select carr_cd, file_name, file_id, tot_rec, tot_succ, tot_trans
      from (select fs.carr_cd,
                   fs.file_name,
                   fs.file_id,
                   fs.tot_rec,
                   fs.tot_succ,
                   count(case
                            when c.status = 'T' then
                             1
                            else
                             null
                          end) over(partition by c.src_file_id) tot_trans,
                   row_number() over(partition by c.src_file_id order by null) rn
              from file_status fs
              left join comm c
                on c.src_file_id = fs.file_id
             where file_id = '12345678')
     where rn = 1;
    
    CARR_CD FILE_NAME            FILE_ID           TOT_REC   TOT_SUCC  TOT_TRANS
    ------- -------------------- -------------- ---------- ---------- ----------
    LIBM    CM_LIBM.TXT          12345678                5          4          2
    
  • I don't see any icon to access the groups next to my tabs, as indicated in the help. I have to use shortcut keys.

    I use Windows XP SP3. He indicates that in help for Firefox 5 icons on the screen to click like the one to the far right of the tab to access the groups bar. I've never seen these so don't know if they charge for my setup or if I just need to turn them on somewhere (can't find anything in the menus there).

    Firefox 4 and 5 seems different for some operating systems?

    The icon tab groups is in the Palette to customize.

    https://support.Mozilla.com/en-us/KB/how+to+customize+the+toolbar

    http://KB.mozillazine.org/Toolbar_customization

    Yes, Firefox 4/5 is a bit different on Windows XP that orange Firefox on Vista and Win7, the button is not displayed and the MenuBar on installations of Windows XP. Simply right click on the bar of Manu and turn off Bar Menu item on the shortcut menu.

    There are also slight variations on the Mac and Linux versions, too.

  • An error occurred when DNS was questioned about the resource record (SRV) service location used to locate a domain controller Active Directory (AD DC) for the domain 'HAMI. LOCAL ".

    An error occurred when DNS was questioned about the resource record (SRV) service location used to locate a domain controller Active Directory (AD DC) for the domain 'HAMI. LOCAL ".

    The error was: "an existing connection was to be closed by the remote host".
    (0 x 00002746 WSAECONNRESET error code)

    The query was for the SRV record for _ldap._tcp.dc._msdcs. HAMI. LOCAL

    Hello

    Your question of Windows 7 is more complex than what is generally answered in the Microsoft Answers forums. It is better suited for the IT Pro TechNet public. Please post your question in the Forums TechNet Windows 7 Technet.

    Here is the link:
    http://social.technet.Microsoft.com/forums/en-us/w7itpronetworking/threads

    Hope this helps

  • FRM - 40603:Records is no longer reserved for the update. Query for changes

    Hi I have a form that has been developing 6i and upgraded to 11g form work well in 6i, but when I try to do the same function in 11g get this error

    FRM - 40603:Records is no longer reserved for the update. Query for changes
    When I commit this execute_query (for_update); It is the form to clear values when it loads, the error comes when I try to delete

    How can I do this

    Action: If you want to change the block, you will need to re - interview.

    Captureerror3.PNG

    I use When-Timer-Expired (WTE) trigger

    You have a 'relationship' defined between the blocks of your master and detail? If so, simply update your master block and the block of details will automatically be re-interviewed. If you cannot use a relationship, then you can use can create a timer in the trigger that updates the database, then in the trigger When-Timer-Expired (WTE) you can go to the retail block and run a query. For example: / * the sample on change trigger * /.

    DECLARE
      timer_id  TIMER;
    BEGIN
    ....your code here that performs the update....
      /* Now create an instance of a timer */
      timer_id := Create_Timer ('upd_detail',1,NO_REPEAT);
    END;/* Sample Form Level When-Timer-Expired trigger */
    DECLARE
      timer_id  TIMER;
    BEGIN
      -- Find the timer first
      timer_id := FIND_TIMER('upd_detail');
      IF NOT ID_NULL(timer_id) THEN
          GO_BLOCK('DETAIL_BLOCK');
          Execute_Query;
      END IF;
    END;
    
  • How to use the Group condition in the ODI mappings

    Hi Experts,

    I have a requirement in the customization of BI applications. Can you please someone explain how to use the LISTAGG function in odi mapping.

    I applied the LISTAGGR function at the level of mapping odi, but I get error below.

    Mapping of ODI: ColumnName: ENAME Expression: LISTAGG (EMP. ENAME, ",") THE GROUP (RANKING BY EMP. ENAME)

    Error:

    ODI-1240: Flow LIST_AGG_FUN_USAGE fails during an operation of integration. This flow of charge table target EMP_BI.

    ODI-1228: task failed LIST_AGG_FUN_USAGE (integration) on the scott_db of ORACLE target connection.

    Caused by: java.sql.SQLSyntaxErrorException: ORA-00937: not a function of simple-group


    Oracle query:

    If I used this sql query in the database the correct result is.

    SELECT DEPTNO, LISTAGG (ENAME, ',') WITHIN THE EMP EMP (ENAME CONTROL) GROUP. DEPTNO;

    Output:

    10CLARK, KING, MILLER
    20ADAMS, FORD, JONES, SCOTT, SMITH
    30ALLEN, JAMES, MARTIN, BLAKE, TURNER, WARD


    Please give your valid solutions, thanks in advance.

    Kind regards

    REDA

    If you try in #ODI12C then in the set of properties, you can select the column which should be used to group by.

    If it's 11g so its bit complicated. Simply replace the mapping with below codes.

    LISTAGG (EMP. ENAME, ",") WITHIN GROUP (ORDER BY ENAME) / * sum() * /.

    Magic!

    Thank you

    Chantal

  • How many times can I use a variable binding in a query of the VO?

    Is it possible that I can use a variable binding in a query of VO just once?

    I test a query that keeps throwing the Houston-27122 error by pressing the application module tester. I tried to limit the problem to the simplest possible case, and it seems that the error is caused by the fact that I use the same variable bind two or more times.

    When the query looks like this:

    query1.png

    I have run, enter 'x' and it returns me the result.

    When I change to:

    query2.png

    I have run, enter the value

    param.png

    and immediately get the error

    error.png

    The same thing in sqlplus runs without problem:

    sqlplus.png

    My version of JDev is build JDEVADF_11.1.1.9.0_GENERIC_150314.0718.6673

    Please, advise.

    P. S. where can I find documentation queries are supported in your? In particular, I'm interested if I can use WITH the clause. There seems to be some confusion on this matter (see, for example, Oracle SQL WITH clause support - JDeveloper and ADF)

    Thank you.

    It depends on:

    Open your VO in JDev and go the the query page.

    In the lower part, there is a drop down 'link type', it is usually set to "JDBC-positional. In this case, you will need to provide the bind value for each occurrence of the variable binding separately.

    You could change that to "named" (don't remember the exact name). But beware, this will also affect all relatioships master retail to others your. I think that this is not a good idea to change the style of binding to a single VO.

    Good bye

    DPT

  • Using SQL to ensure the matching records are mutually exclusive.

    There are two tables defined in the following way:

    Table A

    Number 1

    Number 2

    Date

    ROWID

    Table B

    Number 1

    Number 2

    Date

    Identifier of the line

    Each table stores a call between number 1 and 2 on a specific date. The goal is to map exactly one entry of table A with exactly the record in table B

    in a mutually exclusive way. So a single call to a table must be associated with exactly one call the other table (the key is here

    A.Number1 is B.Number1 and A.Number2 = B.Number2). Because it is a relationship is many to many (the number of source and destination may be paired multiple)

    (time), I'm not able to build a series of sql statements that will allow me to get a relationship one between pairs of telephone numbers.

    I'm not allowed to develop a PL/SQL procedure, which would easily solve this problem.

    I was able to find a solution using MIN(Number 1) KEEP (DENSE_RANK FIRST ORDER BY Date) to THE (PARTITION BY x) the form x

    using temporary tables, which allows me to reach a breaking successively much many relationships (i.e. three broken bones in a 01:58 after

    an iteration, and after one iteration, I arrive at a one to one relationship). However, I can't break these relations some n number of times because it requires number n

    hard curls. Therefore, I need a sophisticated solution that will allow me to achieve a relationship one by one.

    Example of

    Table A

    Record 1

    Number 1:451923456789

    Number 2:541969432045

    Date: 29/07/2015-09:01

    Worksheet 2

    Number 1: 451923456789

    Number 2: 541969432045

    Date: 29/07/2015-09:03

    Table B

    Record 1

    Number 1: 451923456789

    Number 2: 541969432045

    Date: 29/07/2015-09:04

    Worksheet 2

    Number 1: 451923456789

    Number 2: 541969432045

    Date: 29/07/2015-09:05

    If we unite our table A and B by A.Number1 = B.Number1 and A.Number2 = B.Number2, we have 4 records. I'm looking for exactly two records.

    The criteria is to associate by the minimum of the sum of the date of the table A table B date. Therefore, the final result should match:

    (1) record 1 of table A with record 1 of table B.

    sheet 2) 2 table A with 2 record in table B.

    So we must do something to reduce the 4 records resulting from the join of two records describe as we see above.

    The result of the join:

    1st row: TableA.Record1 with TableB.Record1

    2nd place: TableA.Record1 with TableB.Record2

    Rank 3: TableA.Record2 with TableB.Record1

    4th place: TableA.Record2 with TableB.Record2

    What I'm looking for, which is easily achievable with a slider, but not with SQL:

    1st row: TableA.Record1 with TableB.Record1

    4th place: TableA.Record2 with TableB.Record2

    Note that if the minimum date condition allows us to select the necessary records, we won't get the expected results. In other words, using the minimum date.

    the results will be:

    1st row: TableA.Record1 with TableB.Record1

    Rank 3: TableA.Record2 with TableB.Record1

    (criteria - table a minimum date)

    or

    1st row: TableA.Record1 with TableB.Record1

    2nd place: TableA.Record1 with TableB.Record2

    (criteria - date minimum table B)

    Two of these results to break the rule are mutually exclusive.

    Post edited by: 3000640

    If I understand correctly, something like:

    SQL > with tableA (id, telephone1, telephone2, call_date) as)

    2. Select 1, ' 451923456789 ', ' 541969432045',

    3 to_date (July 29, 2015 09:01 ', 'dd.mm.yyyy hh24')

    4 union double all the

    5. Select 2, ' 451923456789 ', ' 541969432045',

    6 to_date (July 29, 2015 09:03 ', 'dd.mm.yyyy hh24')

    double 7),

    TableB 8 (id, telephone1, telephone2, call_date) as)

    9. Select 1, ' 451923456789 ', ' 541969432045',

    10 to_date (July 29, 2015 09:04 ', 'dd.mm.yyyy hh24')

    11 double Union all the

    12. Select 2, ' 451923456789 ', ' 541969432045',

    13 to_date (July 29, 2015 09:05 ', 'dd.mm.yyyy hh24')

    14 double)

    15 select a.id help, a.phone1 aphone1, a.phone2 aphone2,

    16 a.call_date acall_date, b.id offer, b.phone1 bphone1,

    17 b.phone2 bphone2, b.call_date bcall_date

    18 (select id, telephone1, telephone2, call_date,

    19 row_number() over (partition by numbers1, telephone2

    RN 20 order by call_date)

    tablea 21) a

    22 join (select id, telephone1, telephone2, call_date,

    23 row_number() over (partition by numbers1, telephone2

    RN 24 order by call_date)

    tableb 25) b

    26 on a.phone1 = b.phone1 and

    27 a.phone2 = b.phone2 and

    28 a.rn = b.rn;

    HELP APHONE1 APHONE2 ACALL_DATE BPHONE1 BPHONE2 BCALL_DATE OFFERS

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

    1 451923456789 541969432045 July 29, 2015 09:01 1 451923456789 541969432045 July 29, 2015 09:04

    2 451923456789 541969432045 July 29, 2015 09:03 2 451923456789 541969432045 July 29, 2015 09:05

    John

Maybe you are looking for

  • iPhone 7 more Siri do not pick up my voice?

    Recently bought the new iPhone 7 more, 128GB Variant. Long story short, to put in place, was asked to set up the Siri, with the usual to say "Hey Siri" repeatedly speech recognition. However, a few hours later I realized that I was not able to user "

  • Replacing the battery in the MP3 NWZ-E344 drive

    Connected via USB - screen is enabled - shows the battery charge, able to drag and drop files. As soon as I unplug it - its dead. Battery local place open and put the meter on battery - its dead even after be plugged for hours. They said they found n

  • Help me to go wireless with my laptop Equium L300

    I bought a new laptop Toshiba Equium L300. Yesterday I couldn't connect to my Netgear router.It says on screen no network card installed, but in Device Manager it says everything is ok on my adapter. Which is a Realtek RTL 2 810. It's frustrating bee

  • Windows 7 recovery

    Hye... How are you I installed Windows 8 and it is just messed up and and I don't like, so I want to recover my windows 7 64 bit, but I couldn't coz I think my recovery file is corrupted and there is a file missed in it... I don't have the seirial. M

  • Get pictures of small objects with white background

    I have a Canon Rebel XT EOS 350 d.  I also have a light box.  I'm taking pictures of writing, pens against a white background so that I can post them on the web.  No matter what I try, the pictures come out with being too dark, and the background is