by comparing the two date columns

I want to compare two values of the column of the same table. Both the date and time part. but I would like to compare with only the date portion. I want these files where two dates are not same. but it includes a part of the time in the comparison with the following query.
select * from reporttransactions a,  reporttransactions b  
where trunc ( to_date(a.TRANSACTION_DATE, 'DD/MM/YYYY' )) <> trunc (to_date(b.TRANSACTION_CREATION_DATE,'DD/MM/YYYY' ))
any suggestion

I think it's true,

When: WHERE TRUNC (A.TRANSACTION_DATE) = TRUNC (B.TRANSACTION_CREATION_DATE)

223605062     3247     0     0     -     215     1     215     8     8     0     215PKI     01/09/2012     01/09/2012
223605056     5733     0     0     -     131     1     131     9     9     0     131RAS     01/09/2012     01/09/2012
223605050     4568     0     0     -     132     1     132     5     5     0     132FSH     01/09/2012     01/09/2012
223604993     1623     0     0     -     176     1     176     8     8     0     176TCL     01/09/2012     01/09/2012

When: WHERE TRUNC (A.TRANSACTION_DATE)! = TRUNC (B.TRANSACTION_CREATION_DATE);

225833757     9113     0     0     -     161     1     161     3     3     0     161CBE     16/09/2012     16/09/2012
225833757     9113     0     0     -     161     1     161     3     3     0     161CBE     16/09/2012     16/09/2012
225833757     9113     0     0     -     161     1     161     3     3     0     161CBE     16/09/2012     16/09/2012
225833757     9113     0     0     -     161     1     161     3     3     0     161CBE     16/09/2012     16/09/2012
225833757     9113     0     0     -     161     1     161     3     3     0     161CBE     16/09/2012     16/09/2012
225833757     9113     0     0     -     161     1     161     3     3     0     161CBE     16/09/2012     16/09/2012
225833757     9113     0     0     -     161     1     161     3     3     0     161CBE     16/09/2012     16/09/2012
225833757     9113     0     0     -     161     1     161     3     3     0     161CBE     16/09/2012     16/09/2012
225833757     9113     0     0     -     161     1     161     3     3     0     161CBE     16/09/2012     16/09/2012
225833757     9113     0     0     -     161     1     161     3     3     0     161CBE     16/09/2012     16/09/2012
225833757     9113     0     0     -     161     1     161     3     3     0     161CBE     16/09/2012     16/09/2012
225833757     9113     0     0     -     161     1     161     3     3     0     161CBE     16/09/2012     16/09/2012
225833757     9113     0     0     -     161     1     161     3     3     0     161CBE     16/09/2012     16/09/2012

What's wrong?

Tags: Database

Similar Questions

  • How to calculate the time difference in the two date columns time.

    Hi Obiee Experts,

    I came back new requirement on obiee 10g.


    I have two date columns in my table time, data as below.

    StartDate: 18/03/2012-04:40:51

    Closing date: 18/03/2012-04:50:55

    I want to the output as below (Jet lag).

    output
    04:40:51 (less)-04:50:55 = 00:10:04

    I hope you understand my requirement in OBIEE.

    Note: I want to show above the output values in another State for OBIEE10g column.

    Please share me your valuable contributions. Urgent appeals.

    Thank you
    Satya

    Hi Satya,

    Here's another solution. You can try the formula below as it is:

    Cast (floor (TIMESTAMPDIFF (sql_tsi_second, '-SNP_SESSION '.))) SESS_BEG, '-SNP_SESSION '. SESS_END) / 3600) as char). ':' ||
    Cast (floor (mod (TIMESTAMPDIFF (sql_tsi_second, '-SNP_SESSION '.)))) SESS_BEG, '-SNP_SESSION '. ((SESS_END), 3600) / 60) as char). ':' ||
    Cast (mod (TIMESTAMPDIFF (sql_tsi_second, '-SNP_SESSION '.))) SESS_BEG, '-SNP_SESSION '. SESS_END), 60) as char)

    I would like to know if that's what you're looking for.

    Thank you

  • Compare two date columns

    Hello

    I want to compare two columns of dates in a table.

    Here, I wish to confirm that the two values are the same in each record.


    Hope that make sense



    See you soon

    Sexy

    Hi, Vanessa,.

    If d1 and d2 are the two DATE columns:

    SELECT     *     -- or list whatever columns you want to see
    FROM     table_x
    WHERE     d1 != d2
    ;
    

    Displays all the lines where they are declared, but not the same thing.

    If you want to include the lines where one of them is null, but the other is not:

    SELECT     *     -- or list whatever columsn\ you want to see
    FROM     table_x
    WHERE     LNNVL (d1 = d2)
    ;
    
  • By comparing the two contours

    Hi Experts,


    in my project for 1 application 2 Data bases like (Aculas, Forecast).

    I want to compare the two contours... is there no matter what automation is there... pls sugest me.

    Now I compare manually.


    Thanks in advance!

    Yes it's true. You can download it from

    http://www.appliedolap.com/

    Amol

  • OBIEE 11.1.1.6.6 - analysis shows the two dates instead of a guest

    Hi all

    my analysis shows somehow the two dates instead of a guest.

    How can it be?

    Tell me please what additional information should I include for you to help me.

    OBIEE 11.1.1.6.6

    UPD: prompt screenshots

    http://Marchello.CCX-grads.org/IMG/BI_prompt_001.PNG

    http://Marchello.CCX-grads.org/IMG/BI_prompt_002.PNG

    I started to use the dashboard to display analysis, now issue additional date disappeared.

  • How to count the number of Sundays between the two dates

    Hello

    I want the number of Sundays between the two dates

    example of

    number of number of Sundays between 4 January 2013 ' and April 30, 2013 "in a select query, I have to include this as a sub query in my select statement.

    nordine B wrote:
    Hi Frank,.
    Have 1 doubt...

    In many countries the week could me "Monday". How the application handles it?
    Or did I get something wrong?

    Help, please!

    For ' IW'(ISO week) early in the day is always Monday...

    It's so simple - calculate the weeks between two dates based on Monday... This is the number of Sundays...

    NEXT_DAY is another option...

    SQL> with dd as
      2  (
      3      select TO_DATE('01-04-2013','dd-mm-yyyy') fdt, TO_DATE('30-04-2013','dd-mm-yyyy') ldt from dual
      4  )
      5  SELECT       fdt,ldt,
      6            (next_day(ldt,'sunday')-next_day(fdt-1,'sunday'))/7 sdays
      7  FROM         dd;
    
    FDT       LDT            SDAYS
    --------- --------- ----------
    01-APR-13 30-APR-13          4
    

    Published by: JAC on May 2, 2013 12:20

  • Migrated virtual machine appears in the two data stores

    Hi all

    A bit of background on our installation first. servers ESX 3.5 vcenter 4.0 (just improved 2.5) + 2 + 2 data warehouses configured in 1 box of MSA.

    Here is what happened. I've migrated a VM from A to B data store using "Migrate" in vSphere client on vCenter.

    On the vSphere client, virtual machine displays now two data warehouses. In the browser data store, the vme even appears in the two data stores. Datastore shows 20 GB to 20 GB provisioned and 0 GB to 20 GB used. B displays 20 of 20 put into service and used 20 20 GB.

    Migration seems to have succeeded. I migrated about 10 other vm and they reside only on a data store. All virtual machines are working properly. I tried to migrate the computer back to A virtual. He showed only a data store. But the problem appeared again when I migrated the vm to B. I tried to move the virtual machine back and forth between servers ESX, no difference.

    Any ideas? The virtual machine is working well, and it is not necessarily a critical problem. But it's annoying, because I intend to reorganize the data store has and the fear it could cause a problem.

    Thank you so much in advance!

    anything mounted on the CD/DVD drive, as an ISO which can be on A Datastore?

  • How to compare data from the two table column by column and connect the result compared to the separate table

    Hello experts...

    I'm new to this forum and Oracle coding complex.

    I have a task in which I want to compare two tables with the same structure, same columns. My Oracle database is 11g Release 2. I want this column-by-column comparison and save the result in a separate table. (say result_table)

    The structure of the table would be as follows:

    SQL > desc emp;

    Name                                      Null?    Type

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

    EMPNO NOT NULL NUMBER 4

    ENAME VARCHAR2 (10)

    JOB                                                VARCHAR2(9)

    MGR                                                NUMBER(4)

    HIREDATE DATE

    SAL                                                NUMBER(7,2)

    COMM                                               NUMBER(7,2)

    DEPTNO NUMBER (2)

    SQL > emp_comp desc;

    Name                                      Null?    Type

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

    EMPNO NOT NULL NUMBER 4

    ENAME VARCHAR2 (10)

    JOB                                                VARCHAR2(9)

    MGR                                                NUMBER(4)

    HIREDATE DATE

    SAL                                                NUMBER(7,2)

    COMM                                               NUMBER(7,2)

    DEPTNO NUMBER (2)

    Both of the tables EMPNO is the primary key.

    I want to compare these two tables based on the EMPNO (EMPNO even is both tables).

    The result log table would be as follows:

    SQL > create table result_table

    2 (check_sr_no, number (5),)

    table_name 3 varchar2 (30),

    ROW_ID 4 varchar2 (20).

    column_name 5 varchar2 (20).

    6 column_data varchar2 (1000).

    compared_by 7 varchar2 (10));

    Table created.

    SQL > alter table result_table

    2 Add the constraint result_table_pk

    3 primary key (check_sr_no);

    Modified table.

    The name of the table and the name of the column will not be hardcoded (based parameter by user)

    I tried to use the dbms_comparison package, but do not find comparison of column to column.

    I also used by using the query operator LESS. It's showing the difference in rank.

    I also went to https://asktom.oracle.com/pls/apex/f?p=100:11:0:P11_QUESTION_ID:2151582681236

    Your help will be very appreciated.

    Thank you

    DK

    Tom Kyte has answered this question MANY times over the years. Here are links for its solution

    https://asktom.Oracle.com/pls/Apex/f?p=100:11:0:P11_QUESTION_ID:4934799800346640847

  • By comparing the two huge table columns

    Hello

    I want to compare two tables each of RECON_APPEND_01 table contains 375 million and RECON_VS_24082011 450 million records.
    RECON_APPEND_01 is a normal table and RECON_VS_24082011 is range partitoned table.
    The two table has a primary key on the column Serial_number. (Oracle 11g R2)

    Requirment is to obtain the records in the RECON_APPEND_01 table that are not present in RECON_VS_24082011.
    I came across a few suggestions for using operator less. Here is the query and its plan to explain
    CREATE TABLE RECON_APPEND_01
    PARALLEL 3
    NOLOGGING
    AS
    ( SELECT   SERIAL_NUMBER
    FROM   RECON_APPEND_01
    minus
    select SERIAL_NUMBER from RECON_VS_24082011
    )
    Explain the Plan:
    --------------------------------------------------------------------------------------------------------------------------
    | Id  | Operation                    | Name            | Rows  | Bytes |TempSpc| Cost (%CPU)|    TQ  |IN-OUT| PQ Distrib |
    --------------------------------------------------------------------------------------------------------------------------
    |   0 | CREATE TABLE STATEMENT       |                 |   378M|  6451M|       |  1398K (43)|        |      |            |
    |   1 |  PX COORDINATOR              |                 |       |       |       |            |        |      |            |
    |   2 |   PX SEND QC (RANDOM)        | :TQ10002        |       |       |       |            |  Q1,02 | P->S | QC (RAND)  |
    |   3 |    LOAD AS SELECT            | RECON_APPEND_03 |       |       |       |            |  Q1,02 | PCWP |            |
    |   4 |     MINUS                    |                 |       |       |       |            |  Q1,02 | PCWP |            |
    |   5 |      SORT UNIQUE             |                 |   378M|  4336M|  7255M|   775K  (4)|  Q1,02 | PCWP |            |
    |   6 |       PX RECEIVE             |                 |   378M|  4336M|       |   114K  (3)|  Q1,02 | PCWP |            |
    |   7 |        PX SEND HASH          | :TQ10000        |   378M|  4336M|       |   114K  (3)|  Q1,00 | P->P | HASH       |
    |   8 |         PX BLOCK ITERATOR    |                 |   378M|  4336M|       |   114K  (3)|  Q1,00 | PCWC |            |
    |   9 |          TABLE ACCESS FULL   | RECON_APPEND_01 |   378M|  4336M|       |   114K  (3)|  Q1,00 | PCWP |            |
    |  10 |      SORT UNIQUE             |                 |   184M|  2115M|  3539M|   538K  (3)|  Q1,02 | PCWP |            |
    |  11 |       PX RECEIVE             |                 |   184M|  2115M|       |   216K  (1)|  Q1,02 | PCWP |            |
    |  12 |        PX SEND HASH          | :TQ10001        |   184M|  2115M|       |   216K  (1)|  Q1,01 | P->P | HASH       |
    |  13 |         PX BLOCK ITERATOR    |                 |   184M|  2115M|       |   216K  (1)|  Q1,01 | PCWC |            |
    |  14 |          INDEX FAST FULL SCAN| SYS_C002617302  |   184M|  2115M|       |   216K  (1)|  Q1,01 | PCWP |            |
    --------------------------------------------------------------------------------------------------------------------------
     
    Another alternate query:
    CREATE TABLE recon_append_02
    PARALLEL 3
    NOLOGGING
    AS
    SELECT   *
    FROM   RECON_APPEND_01 a
    WHERE   NOT EXISTS (SELECT  'X'
    FROM   RECON_VS_24082011 b
    WHERE   b.SERIAL_NUMBER = a.SERIAL_NUMBER)
    Explain the Plan:
    ------------------------------------------------------------------------------------------------------------
    | Id  | Operation              | Name            | Rows  | Bytes | Cost (%CPU)|    TQ  |IN-OUT| PQ Distrib |
    ------------------------------------------------------------------------------------------------------------
    |   0 | CREATE TABLE STATEMENT |                 |   378M|    26G|   450K (10)|        |      |            |
    |   1 |  PX COORDINATOR        |                 |       |       |            |        |      |            |
    |   2 |   PX SEND QC (RANDOM)  | :TQ10000        |   378M|    26G|   153K (28)|  Q1,00 | P->S | QC (RAND)  |
    |   3 |    LOAD AS SELECT      | RECON_APPEND_02 |       |       |            |  Q1,00 | PCWP |            |
    |   4 |     NESTED LOOPS ANTI  |                 |   378M|    26G|   153K (28)|  Q1,00 | PCWP |            |
    |   5 |      PX BLOCK ITERATOR |                 |       |       |            |  Q1,00 | PCWC |            |
    |   6 |       TABLE ACCESS FULL| RECON_APPEND_01 |   378M|    22G|   116K  (5)|  Q1,00 | PCWP |            |
    |   7 |      INDEX UNIQUE SCAN | SYS_C002617302  |     1 |    12 |     0   (0)|  Q1,00 | PCWP |            |
    ------------------------------------------------------------------------------------------------------------
    Based on the plan I've run the second query, but it's taking a lot of time around 4 hours and still running.
    Please suggest.

    With respect,
    Adeline Faure

    Look carefully at the request of Tubby. Your problem in your test is with b.val = null. You can't compare anything on a null using normal operators.

    SQL> select * from target_tab;
    
           VAL
    ----------
             1
             2
             3
             4
             5
             6
             7
             8
             9
            10
    
    SQL> select * from source_tab;
    
           VAL
    ----------
             6
             7
             8
             9
            10
    
    SQL> select a.*
      2  from target_tab a, source_tab b
      3  where a.val = b.val(+) and
      4        b.val is null;
    
           VAL
    ----------
             5
             1
             4
             2
             3
    

    John

  • Compare sysdate with date column value

    Hello

    I need to compare the current_date (sysdate) with the value of column date in the sql below.

    Current_date is sysdate in the sql below.

    Can someone please let me know if the below sql is correct.

    SELECT ZZ. ZIP_CDE

    CC. CITY_NAM

    CC. ST_ABBR

    ZZ. ZIP_CDE_TYP_CDE

    ZZ. ZIP_CDE_STRT_DTE

    OF MDMGEO. T_CITY CC

    MDMGEO. ZC T_ZIP_CITY

    MDMGEO. ZZ T_ZIP_CODE

    MDMSTGGEO. T_USPS_DETAIL_RECORD_distinct T

    WHERE CC. CITY_GNRTD_ID = ZC. CITY_GNRTD_ID

    AND ZZ. ZIP_CDE = ZC. ZIP_CDE

    AND ZZ. ZIP_CDE_STRT_DTE = ZC. ZIP_CDE_STRT_DTE

    AND CURRENT_DATE BETWEEN ZZ. ZIP_CDE_STRT_DTE

    AND ZZ. ZIP_CDE_END_DTE

    AND CURRENT_DATE BETWEEN ZC. ZIP_CITY_STRT_DTE

    AND ZZ. ZIP_CDE = T.DTL_ZIP_CDE

    AND CC. CITY_NAM = PRFRD_LST_LINE_CITY_ST_KEY_NAM T.

    AND CC. ST_ABBR = T.ZIP_ST_ABBR_CDE

    Thank you!

    I want to sleep... maybe too ZZ

    In any case, apparently. What is the problem if necessary?

  • By comparing the two registers of the transaction system

    I would like to comment on a matter of data modeling. In our source siebel system, our business users would like a metric that is based on the comparison of two requests for service. Essentially, if the second service request is created 7 or fewer days after the first application service, then it is reported as a reminder. Common element used for this comparison, it is that they both have the same associated assets.

    We could easily create the necessary ETL for the creation of a fact of reminder. However, my question is around to give visibility to the relationship between the two. Essentially, the business users would like that the first service request is related to the second and vice versa. How would you recommend creating this relationship in the star schema?

    For the relationship, you can for example add a column in the dimension of reminder.
    Recalls with the same value (for example the first recall) are related.

    If you want to see the reverse callback number in a one-to-one relationship, you can add another column to store.

    Concerning
    Nico

    Published by: gerardnico on 4-apr-2009 01:17

  • In comparing the two last samples read in

    Hey guys,.

    before the start of my program to test a sample, to check whether its current temperature stable

    So, I read the information of my sample temperature very low frequency (once every 5 seconds) and basically I want to compare the last two samples I have read, and if they are the same allow the next part of the program to start.

    I thought that this could involve using the Labview collector function, but I can't see how I would implement it.

    Any help is very appreciated,

    Sam.

    use a registry node or shift of feedback.

    Write the value to the entry of feedback node and compare to the output

  • compare the two array element and ignore the undesirable element of the array

    Hello

    Here I attached the vi. In this vi I compare table with ideal picture of A to z. normally in an entry, that we get a data with noise, as is show in this vi normally I just need to compare the value has Cwith c D with D with A & B with B, and so on. now the problem is I have to compare ideal picture with input .and string array if the input string is not in series from A to Z the whole comparion is .i false hope you understand my problem and give some suggestion thank you

    Please take a look at this modified version of your code and I would like to know if that's what you are trying to achieve.

    Please, ask questions and make sure you are comfortable and understand what I coded.

  • compare the mixed data clusters which include some floats

    Did someone come up with what they consider to be a slick way to compare groups of mixed (including floats) data for functional equality (close enough)? Are all I have manged to come with specific-the-cluster screws using a while loop with a case statement internal focus on the index to scroll the cluster element by element to make comparisons, using an appropriate method to compare the floats that can accept a tolerance.  I thought that maybe someone can already built a more generic solution based on clusters of variant data conversion and then direction each piece of data to a correct comparison for its data type.

    The attached Zip file has versions v7.1.1, v8.0 and v2014 my VI for this comparison. I need to rework the managed case RefNum objects to the fact that they will be digital or ASCII (e.g.: VISA). I also added an error output to make it easier to tell when the process runs off the rails. At this point, I'll say I'm done with this, because what I created, this is what I need to do and the elves of the forum NOR are harassing me to mark something on this topic as a response. Enjoy!

  • Take the date of the largest of the 3 Date columns

    Hi all

    I have 3 Date/time columns in my table:

    DateTime_1,
    DateTime_2,
    DateTime_3

    Now select the date maximum or greater of any of these 3 columns. A column can be null. I tried to use a combination of coalesce and features larger to get the maximum date value. When I use a coalesce on 3 columns, it works fine, but when I nested him coalesce in the greater function, that is to say Greatest (Coalesce (...)) it takes a null value. Should I include an nvl on each column?

    Any help would be appreciated.

    Thank you
    Ed

    spalato76 wrote:

    all 3 columns can be null, in which case, I would like to keep the value zero, then this might be difficult...

    Not difficult at all, unless 4712-01-01 BC is valid a date for you (which is very likely):

    NULLIF(
           GREATEST(
                    NVL(DateTime_1,DATE '-4712-01-01'),
                    NVL(DateTime_2,DATE '-4712-01-01'),
                    NVL(DateTime_3,DATE '-4712-01-01')
                   ),
           DATE '-4712-01-01'
          )
    

    SY.

Maybe you are looking for