How to achive using analytical functions -- please help

oracle version : 10g
-- 999 means ALL values for that key
with input_parameters as (select 10 filter_key , '10ACCC' filter_value from dual union all
select 50 filter_key ,'10ACCC0001' filter_value from dual union all
select 60 filter_key , 'PIP' filter_value from dual union all
select 70 filter_key , 'A' filter_value from dual) select * from input_parameters;
with profile_search as(
select 100 profile_id , 10 filter_key , '10ACCC' filter_value from dual union all
select 100 profile_id , 50 filter_key , '10ACCC0001' filter_value from dual union all
select 100 profile_id , 50 filter_key , '10ACCC0002' filter_value from dual union all
select 100 profile_id , 60 filter_key , '999' filter_value from dual union all
select 100 profile_id , 70 filter_key , '999' filter_value from dual union all
select 101 profile_id , 10 filter_key , '10ACCC' filter_value from dual union all
select 101 profile_id , 50 filter_key , '10ACCC001' filter_value from dual union all
select 101 profile_id , 60 filter_key , 'PIP' filter_value from dual union all
select 101 profile_id , 70 filter_key , '999' filter_value from dual union all
select 102 profile_id , 10 filter_key , '10ACCC' filter_value from dual union all
select 102 profile_id , 50 filter_key , '10ACCC0001' filter_value from dual union all
select 102 profile_id , 60 filter_key , 'PIP' filter_value from dual union all
select 102 profile_id , 70 filter_key , 'A' filter_value from dual)
select filter_key , wm_concat(filter_value) from profile_search group by profile_id, filter_key ;
need to identify profile that matches input parameters
102 is first match because it matches exactly
101 is second match because 999 can match any value
100 is third match KEY 70 HAS HIGHEST WEIGHT,
KEY 60 has next highest weight and KEY 50 has next highest weight
results required :
profile_id : 102
Edited by: devarade on Jan 19, 2010 8:01 PM
Edited by: devarade on Jan 19, 2010 8:01 PM

I assume there is a typo in your sample:
select 101 profile_id , 50 filter_key , '10ACCC001' filter_value from dual union allshould be:
select 101 profile_id , 50 filter_key , '10ACCC00<font color=red size=2>0</font>1' filter_value from dual union allThen:
with input_parameters as (
                          select 10 filter_key , '10ACCC' filter_value from dual union all
                          select 50 filter_key ,'10ACCC0001' filter_value from dual union all
                          select 60 filter_key , 'PIP' filter_value from dual union all
                          select 70 filter_key , 'A' filter_value from dual
        profile_search as(
                          select 100 profile_id , 10 filter_key , '10ACCC' filter_value from dual union all
                          select 100 profile_id , 50 filter_key , '10ACCC0001' filter_value from dual union all
                          select 100 profile_id , 50 filter_key , '10ACCC0002' filter_value from dual union all
                          select 100 profile_id , 60 filter_key , '999' filter_value from dual union all
                          select 100 profile_id , 70 filter_key , '999' filter_value from dual union all
                          select 101 profile_id , 10 filter_key , '10ACCC' filter_value from dual union all
                          select 101 profile_id , 50 filter_key , '10ACCC0001' filter_value from dual union all
                          select 101 profile_id , 60 filter_key , 'PIP' filter_value from dual union all
                          select 101 profile_id , 70 filter_key , '999' filter_value from dual union all
                          select 102 profile_id , 10 filter_key , '10ACCC' filter_value from dual union all
                          select 102 profile_id , 50 filter_key , '10ACCC0001' filter_value from dual union all
                          select 102 profile_id , 60 filter_key , 'PIP' filter_value from dual union all
                          select 102 profile_id , 70 filter_key , 'A' filter_value from dual
select  profile_id,
        sum(direct_match_cnt) || ' direct matches out of ' || (select count(*) from input_parameters) match
  from  (
         select  b.profile_id,
                 b.filter_key,
                 b.filter_value,
                 sum(case when b.filter_value = a.filter_value then 1 else 0 end) direct_match_cnt
           from  input_parameters a,
                 profile_search b
           where b.filter_key = a.filter_key
             and (b.filter_value = a.filter_value or b.filter_value = '999')
           group by b.profile_id,
                    b.filter_key,
                    b.filter_value
        ) x
  group by profile_id
  having count(*) = (select count(*) from input_parameters)
  order by sum(direct_match_cnt) desc
PROFILE_ID MATCH
       102 4 direct matches out of 4
       101 3 direct matches out of 4
       100 2 direct matches out of 4
SQL> SY.

Similar Messages

  • How to achive this using analytical function-- please help

    version 10g.
    this code works just fine with my requirement. i am tyring to learn analytical functions and implement that in the below query. i tried using row_number ,
    but i could nt achive the desired results. please give me some ideas.
    SELECT c.tax_idntfctn_nmbr irs_number, c.legal_name irs_name,
           f.prvdr_lctn_iid
      FROM tax_entity_detail c,
           provider_detail e,
           provider_location f,
           provider_location_detail pld
    WHERE c.tax_entity_sid = e.tax_entity_sid
       AND e.prvdr_sid = f.prvdr_sid
       AND pld.prvdr_lctn_iid = f.prvdr_lctn_iid
       AND c.oprtnl_flag = 'A'
       AND c.status_cid = 2
       AND e.oprtnl_flag = 'A'
       AND e.status_cid = 2
       AND (c.from_date) =
              (SELECT MAX (c1.from_date)
                 FROM tax_entity_detail c1
                WHERE c1.tax_entity_sid = c.tax_entity_sid
                  AND c1.oprtnl_flag = 'A'
                  AND c1.status_cid = 2)
       AND (e.from_date) =
              (SELECT MAX (c1.from_date)
                 FROM provider_detail c1
                WHERE c1.prvdr_sid = e.prvdr_sid
                  AND c1.oprtnl_flag = 'A'
                  AND c1.status_cid = 2)
       AND pld.oprtnl_flag = 'A'
       AND pld.status_cid = 2
       AND (pld.from_date) =
              (SELECT MAX (a1.from_date)
                 FROM provider_location_detail a1
                WHERE a1.prvdr_lctn_iid = pld.prvdr_lctn_iid
                  AND a1.oprtnl_flag = 'A'
                  AND a1.status_cid = 2)thanks
    Edited by: new learner on May 24, 2010 7:53 AM
    Edited by: new learner on May 24, 2010 10:50 AM

    May be like this not tested...
    select *
    from
    SELECT c.tax_idntfctn_nmbr irs_number, c.legal_name irs_name,
    f.prvdr_lctn_iid, c.from_date as c_from_date, max(c.from_date) over(partition by c.tax_entity_sid) as max_c_from_date,
    e.from_date as e_from_date, max(e.from_date) over(partition by e.prvdr_sid) as max_e_from_date,
    pld.from_date as pld_from_date, max(pld.from_date) over(partition by pld.prvdr_lctn_iid) as max_pld_from_date
    FROM tax_entity_detail c,
    provider_detail e,
    provider_location f,
    provider_location_detail pld
    WHERE c.tax_entity_sid = e.tax_entity_sid
    AND e.prvdr_sid = f.prvdr_sid
    AND pld.prvdr_lctn_iid = f.prvdr_lctn_iid
    AND c.oprtnl_flag = 'A'
    AND c.status_cid = 2
    AND e.oprtnl_flag = 'A'
    AND e.status_cid = 2
    AND pld.oprtnl_flag = 'A'
    AND pld.status_cid = 2
    )X
    where c_from_date=max_c_from_date AND e_from_date =max_e_from_date AND
    pld_from_date=max_pld_from_date

  • E71 - how can i use the gps, please help

    I have never used GPS before, i got E71 last week, it says in the manual that there is an inbuilt gps receiver in it.
    From the discussion here it looked like i still need something else to use the GPS. I saw someone
    mentioned 'Mapping', does E71 come with this program or do i need to get it from somewhere?
    Can someone tell me how i can use the GPS in the E71? Is it possible to use gps in this phone without paying additional charges?
    Many thanks.
    Solved!
    Go to Solution.

    Phones with free navigation
    Nokia E72
    Nokia E71
    Nokia E66
    Nokia N97 mini Gold Edition
    Nokia N97mini
    Nokia N97
    Nokia N86 8MP
    Nokia X6 16GB
    Nokia 5800 XpressMusic
    Nokia 5235 Ovi Music Unlimited
    Nokia 5230
    To find Ovi Maps for other phones visit Maps Support-http://www.nokia.co.in/get-support-and-software/download-software/maps-support/compatibility-and-dow...
    How to install and setup GPS in nokia E-71.
    Firstly Install Nokia Ovi Suite (advance version of PC Suite) in your respected computer.
    http://www.nokia.co.in/get-support-and-software/download-software/nokia-ovi-suite
    After installation of Nokia Ovi Suite go to following link
    http://www.nokia.co.in/explore-services/ovi-maps/downloads?intc=ncomexpserv-fw-ilc-lft-con-na-ncomex...
    Now install the the second link file into your phone, i.e., "nokia_maps_3.03_10wk11_b04_s60_3.1_rom.Nocs.sis".
    After successful installation connect your phone with data cable in PC Suite (DON'T run PC suite application in your system) mode and open Nokia Ovi Suite application in your system.
    Now in Nokia Ovi Suite application click on View-Go to-Maps (make sure your system is connected to Internet and your mobile phone key pad doesn't get locked, if keypad autolock period is on switch it off for that moment and your phone is fully charged, now in maps select Asia in that India and download that India Map (103 MB) into your phone.
    Please Note that do not disconnect your phone from data cable else maps will not get downloaded and will not to be
    transferred to your phone.
    After successful installation of maps into your phone download "Voice Guidance Languages", which ever is preferred by you, if you really want to enjoy it. Like- English(UK)-with street names or in Hindi, Tamil, Urdu.
    Now you are almost done, just take your phone into your hand,
    Go to Maps then select Options-then Settings
    Internet-Connection-Offline ( don't worry your GPS will work fine as data bearer is Nokia which is free of charge, so just relax).
    Navigation-Drive Guidance-Select the desired Voice
    Walk Guidance-Select the desired Voice or you can set it to Beeps and Vibrations (if downloaded).
    Home Location- define you home location by searching in maps, this will make easier to drive back to home by simply selecting Drive Home option while using navigation.
    Now go to option Map-Categories-select the categories you want to be shown on the map.
    Its DONE, now search for any desired location press the selection button and then select Drive to or Walk to option and you will be connected to GPS.
    Please Note as GPS needs free environment so it may not work in home and generally it takes 10-15 minutes to connect so please be patient.

  • How can i use analytic function on these data

    hi ,
    i have the following data:
    id start end
    1 11-oct-2006 03:00:34 12-oct-2006 09:00:10
    1 09-oct-2006 05:00:23 11-oct-2006 03:00:34
    1 08-oct-2006 03:00:23 09-oct-2006 05:00:23
    2 11-oct-2006 11:00:00 11-oct-2006 14:00:00
    1 08-oct-2006 03:00:00 08-oct-2006 04:00:00
    my end results shld be
    id start end
    1 08-oct-2006 05:00:23 12-oct-2006 09:00:10
    2 11-oct-2006 11:00:00 11-oct-2006 14:00:00
    1 08-oct-2006 03:00:00 08-oct-2006 04:00:00
    pls advise
    tks & rdgs

    Mohana ,
    I think Elic's solution can be used here also
    (Group by preserving the order
    sql>select * from t;
    ID ST ED 
    1  11-OCT-06 03.00.34.000000 AM  12-OCT-06 09.00.10.000000 AM 
    1  09-OCT-06 05.00.23.000000 AM  11-OCT-06 03.00.34.000000 AM 
    1  08-OCT-06 04.00.23.000000 AM  09-OCT-06 05.00.23.000000 AM 
    2  11-OCT-06 11.00.00.000000 AM  11-OCT-06 12.00.00.000000 PM 
    1  08-OCT-06 03.00.00.000000 AM  08-OCT-06 04.00.00.000000 AM 
    sql>
    select id,min(st) st,max(ed) ed
    from(
    select id,st,ed, sum(grp) over(order by st) sm
    from(
    select id,st,ed,decode(lag(ed) over(order by st),st,0,1) grp
    from t))
    group by id,sm;
    ID ST ED 
    1  08-OCT-06 03.00.00.000000 AM  08-OCT-06 04.00.00.000000 AM 
    1  08-OCT-06 04.00.23.000000 AM  12-OCT-06 09.00.10.000000 AM 
    2  11-OCT-06 11.00.00.000000 AM  11-OCT-06 12.00.00.000000 PM
    Message was edited by:
            jeneesh                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • How can rewrite the Query using Analytical functions ?

    Hi,
    I have the SQL script as shown below ,
    SELECT cd.cardid, cd.cardno,TT.TRANSACTIONTYPECODE,TT.TRANSACTIONTYPEDESC DESCRIPTION,
    SUM (NVL (CASE tt.transactiontypecode
    WHEN 'LOAD_ACH'
    THEN th.transactionamount
    END, 0)
    ) AS load_ach,
    SUM
    (NVL (CASE tt.transactiontypecode
    WHEN 'FUND_TRANSFER_RECEIVED'
    THEN th.transactionamount
    END,
    0
    ) AS Transfersin,
    ( SUM (NVL (CASE tt.transactiontypecode
    WHEN 'FTRNS'
    THEN th.transactionamount
    END,
    0
    ) +
    SUM (NVL (CASE tt.transactiontypecode
    WHEN 'SEND_MONEY'
    THEN th.transactionamount
    END, 0)
    )) AS Transferout,
    SUM (NVL (CASE tt.transactiontypecode
    WHEN 'WITHDRAWAL_ACH'
    THEN th.transactionamount
    END, 0)
    ) AS withdrawal_ach,
    SUM (NVL (CASE tt.transactiontypecode
    WHEN 'WITHDRAWAL_CHECK'
    THEN th.transactionamount
    END, 0)
    ) AS withdrawal_check,
    ( SUM (NVL (CASE tt.transactiontypecode
    WHEN 'WITHDRAWAL_CHECK_FEE'
    THEN th.transactionamount
    END,
    0
    ) +
    SUM (NVL (CASE tt.transactiontypecode
    WHEN 'REJECTED_ACH_LOAD_FEE'
    THEN th.transactionamount
    END,
    0
    ) +
    SUM (NVL (CASE tt.transactiontypecode
    WHEN 'WITHDRAWAL_ACH_REV'
    THEN th.transactionamount
    END,
    0
    ) +
    SUM (NVL (CASE tt.transactiontypecode
    WHEN 'WITHDRAWAL_CHECK_REV'
    THEN th.transactionamount
    END,
    0
    ) +
    SUM
    (NVL (CASE tt.transactiontypecode
    WHEN 'WITHDRAWAL_CHECK_FEE_REV'
    THEN th.transactionamount
    END,
    0
    ) +
    SUM
    (NVL (CASE tt.transactiontypecode
    WHEN 'REJECTED_ACH_LOAD_FEE_REV'
    THEN th.transactionamount
    END,
    0
    ) +
    SUM (NVL (CASE tt.transactiontypecode
    WHEN 'OVERDRAFT_FEE_REV'
    THEN th.transactionamount
    END, 0)
    ) +
    SUM (NVL (CASE tt.transactiontypecode
    WHEN 'STOP_CHECK_FEE_REV'
    THEN th.transactionamount
    END,
    0
    ) +
    SUM (NVL (CASE tt.transactiontypecode
    WHEN 'LOAD_ACH_REV'
    THEN th.transactionamount
    END, 0)
    ) +
    SUM (NVL (CASE tt.transactiontypecode
    WHEN 'OVERDRAFT_FEE'
    THEN th.transactionamount
    END, 0)
    ) +
    SUM (NVL (CASE tt.transactiontypecode
    WHEN 'STOP_CHECK_FEE'
    THEN th.transactionamount
    END, 0)
    )) AS Fee,
    th.transactiondatetime
    FROM carddetail cd,
    transactionhistory th,
    transactiontype tt,
    (SELECT rmx_a.cardid, rmx_a.endingbalance prev_balance, rmx_a.NUMBEROFDAYS
    FROM rmxactbalreport rmx_a,
    (SELECT cardid, MAX (reportdate) reportdate
    FROM rmxactbalreport
    GROUP BY cardid) rmx_b
    WHERE rmx_a.cardid = rmx_b.cardid AND rmx_a.reportdate = rmx_b.reportdate) a
    WHERE th.transactiontypeid = tt.transactiontypeid
    AND cd.cardid = th.cardid
    AND cd.cardtype = 'P'
    AND cd.cardid = a.cardid (+)
    AND CD.CARDNO = '7116734387812758335'
    --AND TT.TRANSACTIONTYPECODE = 'FUND_TRANSFER_RECEIVED'
    GROUP BY cd.cardid, cd.cardno, numberofdays,th.transactiondatetime,tt.transactiontypecode,TT.TRANSACTIONTYPEDESC
    Ouput of the above query is :
    CARDID     CARDNO     TRANSACTIONTYPECODE     DESCRIPTION     LOAD_ACH     TRANSFERSIN     TRANSFEROUT     WITHDRAWAL_ACH     WITHDRAWAL_CHECK     FEE     TRANSACTIONDATETIME
    6005     7116734387812758335     FUND_TRANSFER_RECEIVED     Fund Transfer Received     0     3.75     0     0     0     0     21/09/2007 11:15:38 AM
    6005     7116734387812758335     FUND_TRANSFER_RECEIVED     Fund Transfer Received     0     272     0     0     0     0     05/10/2007 9:12:37 AM
    6005     7116734387812758335     WITHDRAWAL_ACH     Withdraw Funds via ACH     0     0     0     300     0     0     24/10/2007 3:43:54 PM
    6005     7116734387812758335     SEND_MONEY     Fund Transfer Sent     0     0     1     0     0     0     19/09/2007 1:17:48 PM
    6005     7116734387812758335     FUND_TRANSFER_RECEIVED     Fund Transfer Received     0     1     0     0     0     0     18/09/2007 7:25:23 PM
    6005     7116734387812758335     LOAD_ACH     Prepaid Deposit via ACH     300     0     0     0     0     0     02/10/2007 3:00:00 AM
    I want the output like for Load_ACH there should be one record etc.,
    Can any one help me , how can i rewrite the above query using analytical functions .,
    Sekhar

    Not sure of your requirements but this mayhelp reduce your code;
    <untested>
    SUM (
       CASE
       WHEN tt.transactiontypecode IN
          ('WITHDRAWAL_CHECK_FEE', 'REJECTED_ACH_LOAD_FEE', 'WITHDRAWAL_ACH_REV', 'WITHDRAWAL_CHECK_REV',
           'WITHDRAWAL_CHECK_FEE_REV', 'REJECTED_ACH_LOAD_FEE_REV', 'OVERDRAFT_FEE_REV','STOP_CHECK_FEE_REV',
           'LOAD_ACH_REV', 'OVERDRAFT_FEE', 'STOP_CHECK_FEE')
       THEN th.transactionamount
       ELSE 0) feeAlso, you might want to edit your post and use &#91;pre&#93; and &#91;/pre&#93; tags around your code for formatting.

  • I cracked my screen. I want to use other monitor which I had one. I bought Apple Mini-DP to VGA adapter. It worked. It means I can see ADDITIONAL screen. However I want to use this monitor for the main screen. How can I do?? Please help.

    I cracked my screen. I want to use other monitor which I had one. I bought an Apple Mini-DP to VGA adapter. It worked. It means I can see ADDITIONAL screen. However I want to use this monitor for the main screen. How can I do?? Please help.

    You have the display set in Extended Desktop mode. The Menu Bar and Dock will be on the MacBook display and your background screen on the monitor. In System Preferences>Display on the MacBook screen there should be an Arrangement tab when you have the MacBook hooked up to the monitor and both screens working. When you click the Arrangement tab do you see two monitors side by side? One of them will have a Menu Bar at the top. Just click on the Menu Bar and drag it to the second monitor. That will make the second monitor your main screen. You can now use your MacBook in Clamshell Mode with a wired or Bluetooth keyboard and mouse.  http://support.apple.com/kb/HT3131 When you disconnect from the monitor your Menu Bar will automatically change back to the MacBook.

  • In iOS 5 on the iphone 3gs, how does one disable voice control, not voice dailing.  I have never wanted or used voice control please help me disable it.

    In iOS 5 on the iphone 3gs, how does one disable voice control, not voice dailing.  I have never wanted or used voice control please help me disable it. 

    are you talking about voiceover where the phone is reading things out loud to you? you have to double tap things in voiceover in order to select them. you'll need to go to settings > general > accessibility > and turn off voiceover there

  • How to use analytic function with aggregate function

    hello
    can we use analytic function and aggrgate function in same qurey? i tried to find any example on Net but not get any example how both of these function works together. Any link or example plz share with me
    Edited by: Oracle Studnet on Nov 15, 2009 10:29 PM

    select
    t1.region_name,
    t2.division_name,
    t3.month,
    t3.amount mthly_sales,
    max(t3.amount) over (partition by t1.region_name, t2.division_name)
    max_mthly_sales
    from
    region t1,
    division t2,
    sales t3
    where
    t1.region_id=t3.region_id
    and
    t2.division_id=t3.division_id
    and
    t3.year=2004
    Source:http://www.orafusion.com/art_anlytc.htm
    Here max (aggregate) and over partition by (analytic) function is in same query. So it means we can use aggregate and analytic function in same query and more than one analytic function in same query also.
    Hth
    Girish Sharma

  • Help on Using Analytical Functions

    I am hetting error when i use Analytical functions in Expressions
    AVG( INGRP1.Test1 ) OVER (PARTITION BY INGRP1.Test2)
    Error is as follows
    Line 1, Col 28:
    PLS-00103: Encountered the symbol "OVER" when expecting one of the following:
    * & = - + ; < / > at in is mod remainder not rem
    <an exponent (**)> <> or != or ~= >= <= <> and or like LIKE2_
    LIKE4_ LIKEC_ between || multiset member SUBMULTISET_

    Hi,
    the syntax of this part of the sql statement is okay. Please post the complete statement to identify the error.
    Sometimes oracle identifies the wrong point for the error.
    Regards,
    Detlef

  • Can anyone knows how to fix back camera having pink lines when i use it so please help me  thank you

    can anyone knows how to fix back camera having pink lines when i use it so please help me  thank you
    <Email Edited by Host>

    You're welcome.
    The 6.1.4 update had nothing to do with this. If it did, then every iPhone with 6.1.4 installed would have the same problem.
    Apple doesn't support downgrading the firmware, which won't change anything.
    If an Apple Store is miles away, then call AppleCare.

  • Im Using iPhone 4 factory Unlocked device iOS 7, but device was feels slow, so i want to restore to iOS 6.1.3. how can i do this? please help me anyone itz urgent.

    Im Using iPhone 4 factory Unlocked device iOS 7, but device was feels slow, so i want to restore to iOS 6.1.3. how can i do this? please help me anyone itz urgent.

    As has always been the case, you cannot go back.
    Sorry

  • How to use Analytic functions in Forms10g

    Hi,
    Can we use Analytic function in forms10g like Lead & Lag.
    Thanks & Regards,

    Use a db view as a data source of your form block ....
    Greetings...
    Sim

  • Should I use Analytic functions ?

    Hello,
    I have a table rci_dates with the following structure (rci_id,visit_id,rci_name,rci_date).
    A sample of data in this table is as given below.
    1,101,'FIRST VISIT', '2010-MAY-01',
    2,101,'FIRST VISIT', '2010-MAY-01'
    3,101,'FIRST VISIT', '2010-MAY-01'
    4,101,'FIRST VISIT', '2010-MAY-01'
    5,102,'SECOND VISIT', '2010-JUN-01',
    6,102,'SECOND VISIT', '2010-JUN-01'
    7,102,'SECOND VISIT', '2010-JUN-01'
    8,102,'SECOND VISIT', '2010-JUL-01'
    I want to write a query which returns me the records which are similar to the record with rc_id =8 since the rci_date is different within the visit_id 102. Where as in Visit_id 101 the rci_dates are all same so it should not be displayed in the output returned by my query.
    How can I do this ? Should I be using analytic functions. Can someone please let me know.
    Thanks

    ok i have created the table and inserted the data. but it appears that the data are the output you are expecting, they all the same visit_id.
    SQL> CREATE TABLE RCI
      2  (RCI_ID NUMBER(10) NOT NULL,
      3   VISIT_ID NUMBER(10) NOT NULL,
      4   RCI_NAME VARCHAR2(20 BYTE) NOT NULL,
      5   DCI_DATE VARCHAR2(8 BYTE));
    Table created
    SQL> INSERT INTO RCI ( RCI_ID, VISIT_ID, RCI_NAME, DCI_DATE ) VALUES ( 14876540, 12140, 'SCREENING', '19000101');
    1 row inserted
    SQL> INSERT INTO RCI ( RCI_ID, VISIT_ID, RCI_NAME, DCI_DATE ) VALUES ( 14876640, 12140, 'SCREENING', '19000101');
    1 row inserted
    SQL> INSERT INTO RCI ( RCI_ID, VISIT_ID, RCI_NAME, DCI_DATE ) VALUES ( 14876740, 12140, 'SCREENING', '19000101');
    1 row inserted
    SQL> INSERT INTO RCI ( RCI_ID, VISIT_ID, RCI_NAME, DCI_DATE ) VALUES ( 14876840, 12140, 'SCREENING', '19000101');
    1 row inserted
    SQL> INSERT INTO RCI ( RCI_ID, VISIT_ID, RCI_NAME, DCI_DATE ) VALUES ( 14876940, 12140, 'SCREENING', '19000101');
    1 row inserted
    SQL> INSERT INTO RCI ( RCI_ID, VISIT_ID, RCI_NAME, DCI_DATE ) VALUES ( 14877040, 12140, 'SCREENING', '19000101');
    1 row inserted
    SQL> INSERT INTO RCI ( RCI_ID, VISIT_ID, RCI_NAME, DCI_DATE ) VALUES ( 14877140, 12140, 'SCREENING', '19000101');
    1 row inserted
    SQL> INSERT INTO RCI ( RCI_ID, VISIT_ID, RCI_NAME, DCI_DATE ) VALUES ( 14877240, 12140, 'SCREENING', '19000101');
    1 row inserted
    SQL> INSERT INTO RCI ( RCI_ID, VISIT_ID, RCI_NAME, DCI_DATE ) VALUES ( 14877240, 12140, 'SCREENING', '19000101');
    1 row inserted
    SQL> INSERT INTO RCI ( RCI_ID, VISIT_ID, RCI_NAME, DCI_DATE ) VALUES ( 14877640, 12140, 'SCREENING', '19000101');
    1 row inserted
    SQL> INSERT INTO RCI ( RCI_ID, VISIT_ID, RCI_NAME, DCI_DATE ) VALUES ( 14877740, 12140, 'SCREENING', '19000101');
    1 row inserted
    SQL> INSERT INTO RCI ( RCI_ID, VISIT_ID, RCI_NAME, DCI_DATE ) VALUES ( 14877840, 12140, 'SCREENING', '19000101');
    1 row inserted
    SQL> INSERT INTO RCI ( RCI_ID, VISIT_ID, RCI_NAME, DCI_DATE ) VALUES ( 14877940, 12140, 'SCREENING', '19000101');
    1 row inserted
    SQL> INSERT INTO RCI ( RCI_ID, VISIT_ID, RCI_NAME, DCI_DATE ) VALUES ( 14878040, 12140, 'SCREENING', '19000101');
    1 row inserted
    SQL> INSERT INTO RCI ( RCI_ID, VISIT_ID, RCI_NAME, DCI_DATE ) VALUES ( 14878140, 12140, 'SCREENING', '19000101');
    1 row inserted
    SQL> INSERT INTO RCI ( RCI_ID, VISIT_ID, RCI_NAME, DCI_DATE ) VALUES ( 14878240, 12140, 'SCREENING', '19000101');
    1 row inserted
    SQL> INSERT INTO RCI ( RCI_ID, VISIT_ID, RCI_NAME, DCI_DATE ) VALUES ( 14878340, 12140, 'SCREENING', '19000101');
    1 row inserted
    SQL> INSERT INTO RCI ( RCI_ID, VISIT_ID, RCI_NAME, DCI_DATE ) VALUES ( 14878440, 12140, 'SCREENING', '19000101');
    1 row inserted
    SQL> INSERT INTO RCI ( RCI_ID, VISIT_ID, RCI_NAME, DCI_DATE ) VALUES ( 14878540, 12140, 'SCREENING', '19000101');
    1 row inserted
    SQL> INSERT INTO RCI ( RCI_ID, VISIT_ID, RCI_NAME, DCI_DATE ) VALUES ( 14877640, 12140, 'SCREENING', '19000101');
    1 row inserted
    SQL> INSERT INTO RCI ( RCI_ID, VISIT_ID, RCI_NAME, DCI_DATE ) VALUES ( 14877740, 12140, 'SCREENING', '19000101');
    1 row inserted
    SQL> INSERT INTO RCI ( RCI_ID, VISIT_ID, RCI_NAME, DCI_DATE ) VALUES ( 14878340, 12140, 'SCREENING', '19000101');
    1 row inserted
    SQL> INSERT INTO RCI ( RCI_ID, VISIT_ID, RCI_NAME, DCI_DATE ) VALUES ( 14878540, 12140, 'SCREENING', '19000101');
    1 row inserted
    SQL> INSERT INTO RCI ( RCI_ID, VISIT_ID, RCI_NAME, DCI_DATE ) VALUES ( 17418240, 12140, 'SCREENING', '20000101');
    1 row inserted
    SQL> INSERT INTO RCI ( RCI_ID, VISIT_ID, RCI_NAME, DCI_DATE ) VALUES ( 17418340, 12140, 'SCREENING', '20000101');
    1 row inserted
    SQL> INSERT INTO RCI ( RCI_ID, VISIT_ID, RCI_NAME, DCI_DATE ) VALUES ( 17418440, 12140, 'SCREENING', '20000101');
    1 row inserted
    SQL> INSERT INTO RCI ( RCI_ID, VISIT_ID, RCI_NAME, DCI_DATE ) VALUES ( 14878240, 12140, 'SCREENING', '20000101');
    1 row inserted
    SQL> INSERT INTO RCI ( RCI_ID, VISIT_ID, RCI_NAME, DCI_DATE ) VALUES ( 18790240, 12140, 'SCREENING', '19000101');
    1 row inserted
    SQL> INSERT INTO RCI ( RCI_ID, VISIT_ID, RCI_NAME, DCI_DATE ) VALUES ( 21724540, 12140, 'SCREENING', '19000101');
    1 row inserted
    SQL> INSERT INTO RCI ( RCI_ID, VISIT_ID, RCI_NAME, DCI_DATE ) VALUES ( 14876540, 12140, 'SCREENING', '20091015');
    1 row inserted
    SQL> commit;
    Commit complete
    SQL> select * from rci;
         RCI_ID    VISIT_ID RCI_NAME             DCI_DATE
       14876540       12140 SCREENING            19000101
       14876640       12140 SCREENING            19000101
       14876740       12140 SCREENING            19000101
       14876840       12140 SCREENING            19000101
       14876940       12140 SCREENING            19000101
       14877040       12140 SCREENING            19000101
       14877140       12140 SCREENING            19000101
       14877240       12140 SCREENING            19000101
       14877240       12140 SCREENING            19000101
       14877640       12140 SCREENING            19000101
       14877740       12140 SCREENING            19000101
       14877840       12140 SCREENING            19000101
       14877940       12140 SCREENING            19000101
       14878040       12140 SCREENING            19000101
       14878140       12140 SCREENING            19000101
       14878240       12140 SCREENING            19000101
       14878340       12140 SCREENING            19000101
       14878440       12140 SCREENING            19000101
       14878540       12140 SCREENING            19000101
       14877640       12140 SCREENING            19000101
       14877740       12140 SCREENING            19000101
       14878340       12140 SCREENING            19000101
       14878540       12140 SCREENING            19000101
       17418240       12140 SCREENING            20000101
       17418340       12140 SCREENING            20000101
       17418440       12140 SCREENING            20000101
       14878240       12140 SCREENING            20000101
       18790240       12140 SCREENING            19000101
       21724540       12140 SCREENING            19000101
       14876540       12140 SCREENING            20091015
    30 rows selected
    SQL> -- using the sample similar code that i have previously posted it returned all the rows.
    SQL> select rci.*
      2    from rci
      3   where rci.visit_id in (select r1.visit_id
      4                            from (select rci.visit_id,
      5                                         count(*) over (partition by rci.visit_id, rci.dci_date order by rci.visit_id) rn
      6                                    from rci) r1
      7                            where r1.rn = 1)
      8  order by rci.rci_id;
         RCI_ID    VISIT_ID RCI_NAME             DCI_DATE
       14876540       12140 SCREENING            20091015
       14876540       12140 SCREENING            19000101
       14876640       12140 SCREENING            19000101
       14876740       12140 SCREENING            19000101
       14876840       12140 SCREENING            19000101
       14876940       12140 SCREENING            19000101
       14877040       12140 SCREENING            19000101
       14877140       12140 SCREENING            19000101
       14877240       12140 SCREENING            19000101
       14877240       12140 SCREENING            19000101
       14877640       12140 SCREENING            19000101
       14877640       12140 SCREENING            19000101
       14877740       12140 SCREENING            19000101
       14877740       12140 SCREENING            19000101
       14877840       12140 SCREENING            19000101
       14877940       12140 SCREENING            19000101
       14878040       12140 SCREENING            19000101
       14878140       12140 SCREENING            19000101
       14878240       12140 SCREENING            19000101
       14878240       12140 SCREENING            20000101
       14878340       12140 SCREENING            19000101
       14878340       12140 SCREENING            19000101
       14878440       12140 SCREENING            19000101
       14878540       12140 SCREENING            19000101
       14878540       12140 SCREENING            19000101
       17418240       12140 SCREENING            20000101
       17418340       12140 SCREENING            20000101
       17418440       12140 SCREENING            20000101
       18790240       12140 SCREENING            19000101
       21724540       12140 SCREENING            19000101
    30 rows selected
    SQL> just as what frank have said it will be helpful if you post a sample output based on the original posting, that is in the first posting you have.

  • How can I use 3D function in Photoshop CS6 (student package)?

    Please let me know how can I use 3D function in Photoshop CS6 (student package)?
    Thanks,

    Thanks so much for your helpful reply.
    Now I' ve already installed Adobe Creative Suite 6 Production Premium (Student Package), Extended included. But when I open Photoshop CS6, there' s still no 3D function in menu bar.
    Would you please tell me how to activate this function?
    Thanks,

  • How can I use select() function in POSIX thread program.

    Hello
    Now I making a my own progam with POSIX thread in Solaris 8 Environment.
    But I have some trouble in POSIX thread.
    I saw that If use POSIX thread then use -D_POSIX_C_SOURCE=???L flag into compile options in
    Multithreaded Programming Guide.
    So I use that in my Makefile. But I can't compile my program.
    Now I found that if use POSIXC_SOURCE flag, cannot use timeval structure (defined in <sys/time.h>) in <sys/resource.h>.
    So compiling was stop into select() function. Because select() function use timeval structure.
    And fd_set structure(defined in <sys/select.h>) is same.
    How I solve this problem.
    Please help me.
    Thank you.

    Thanks so much for your helpful reply.
    Now I' ve already installed Adobe Creative Suite 6 Production Premium (Student Package), Extended included. But when I open Photoshop CS6, there' s still no 3D function in menu bar.
    Would you please tell me how to activate this function?
    Thanks,

Maybe you are looking for