Complex Query/Subreports - Please Help!!

Post Author: BarbaraD
CA Forum: General
I am new to Crystal Reports, and I am having a hard time getting my report to work.  I need to display a detail line for each account, grouped by sales rep. That part is fine.  As part of the detail line, I also need to show the next activity date and next activity description for the account (for example, 10/01/07 Meeting).  That is the tricky part.  I'd like to do a subreport with the following query, but it looks like Crystal cannot handle subqueries:
SELECT    ACTIVITY."ACCOUNTID",    ACTIVITY."STARTDATE",    ACTIVITY."DESCRIPTION"FROM    ACTIVITYINNER JOIN ( SELECT ACTIVITY."ACCOUNTID", min(ACTIVITY."STARTDATE") startdate    FROM ACTIVITY  GROUP BY ACTIVITY.ACCOUNTID  ) BON ACTIVITY."ACCOUNTID" = B."ACCOUNTID"WHERE    ACTIVITY."ACCOUNTID" = 'some account id' and    ACTIVITY."STARTDATE" = B."startdate"
I also tried to create a subreport that gets just the min(startdate) and puts it in a shared variable, which worked fine. I then tried to create another subreport that would get the activity description using the shared variable from the 1st subreport as a parameter.  This seemed to work until I came across an account that had 2 activities scheduled for the exact date/time.  I then got an error message  "No rowset was returned for this table, query or procedure." , followed by "Error detected by database DLL." .    Does anybody have any suggestions on how I can do this????

i am not lying to anyone..i am not into EJB'sThen tell that to your potential employer. As it
stands, you're trying to make them thing you know
more than you actually do. If EJBs are not a
requirement for the job, it won't matter than you
don't know them. And if they are, then you don't
belong in the job anyway.
Why are these concepts so hard for people to grasp?
(And I'm not talking about EJBs.)Yep, if you are applying for a job that is not EJBwise, and you perform well in the relevant areas nobody will let you out because you honestly stated you don't know something they don't need. Leave the question blank and explain why you did it.

Similar Messages

  • Pass username and password ADFS without using query string, Please help.

    pass username and password ADFS without using query string, Please help.
    I used query string , but it is unsecured to pass credentials over url, with simple tool like httpwatch , anyone can easily get the password and decrypt it.

    Hi,
    According to your post, my understanding is that you had an issue about the ADFS.
    As this issue is related to ADFS, I recommend you post your issue to the forum for ADFS.
    http://social.msdn.microsoft.com/Forums/vstudio/en-US/home?forum=Geneva
    The reason why we recommend posting appropriately is you will get the most qualified pool of respondents, and other partners who read the forums regularly can either share their knowledge or learn from your interaction with us.
    Thank you for your understanding and support.
    Thanks,
    Jason
    Forum Support
    Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Subscriber Support, contact
    [email protected]
    Jason Guo
    TechNet Community Support

  • A complex join . Please help

    I have a complex join to perform.
    I need some help please.
    I have a table call Table A
    TableA
    id_entity    inst_type     inst_code  dt_trade
    AGL          SE              5660249    01 Feb '06
    AGL          SE              5660249    01 Feb '06
    AGL          SE              5660249    05 Feb '06
    TableB
    id_inst                 id_inst_xref
    0029010          SE     5660249
    0070789          SE     5660249
    0071190          SE     5660249
    0072385          SE     5660249
    0073215          SE     5660249
    0084797          SE     5660249
    0091375          SE     5660249
    Table C
    id_inst     id_isin
    0029010     FR0000120172
    0070789         FR0000120172
    0071190     FR0000120172
    *** All the id_inst in TableC have the same id_isinAll the 3 Tables now have to be linked to together such that
    Output
    id_entity    Inst_code   id_isin         dt_trade    count
    AGL          5660249     FR0000120172    01 Feb '06  2
    AGL          5660249     FR0000120172    02 Feb '06  1What I am doing is
    Select ta.id_entity,ta.id_inst_code,ta.dt_trade,tc.id_isin,count(*)
    from  TableA ta,TableB tb,TableC tc
    where ta.id_entity = 'AGL'    and
          ta.inst_code       = (How do I get the id_inst from TableB)
                                and then use the id_inst from TableB
                                to get the id_isin from TableC)
    group by ta.id_entity,ta.id_inst_code,ta.dt_trade,tc.id_isin
    Can I say :
    Select ta.id_entity,ta.id_inst_code,ta.dt_trade,tc.id_isin,count(*)
    from  TableA ta,TableB tb,TableC tc
    where ta.id_entity = 'AGL'    and
          ta.inst_code = (Select distinct tb.id_inst
                          from tableB tb
                          where tb.id_inst_xref = ta.id_inst_code
                          ) and then link the id_inst from here to TableC ang get the id_isin??Can someone please help.??

    I had a bit of a go at writing the query but I don't quite understand the data. Here is what I tried.
    jeff@ORA10GR2> create table tablea
    2 (id_entity varchar2(3)
    3 ,inst_type varchar2(3)
    4 ,inst_code number
    5 ,dt_trade date);
    Table created.
    jeff@ORA10GR2>
    jeff@ORA10GR2> insert into tablea values ('AGL', 'SE', 5660249, to_date('20060201','YYYYMMDD'));
    1 row created.
    jeff@ORA10GR2> insert into tablea values ('AGL', 'SE', 5660249, to_date('20060201','YYYYMMDD'));
    1 row created.
    jeff@ORA10GR2> insert into tablea values ('AGL', 'SE', 5660249, to_date('20060205','YYYYMMDD'));
    1 row created.
    jeff@ORA10GR2>
    jeff@ORA10GR2> create table tableb
    2 (id_inst number
    3 ,inst_type varchar2(3)
    4 ,id_inst_xref number);
    Table created.
    jeff@ORA10GR2>
    jeff@ORA10GR2> insert into tableb values (0029010, 'SE', 5660249);
    1 row created.
    jeff@ORA10GR2> insert into tableb values (0070789, 'SE', 5660249);
    1 row created.
    jeff@ORA10GR2> insert into tableb values (0071190, 'SE', 5660249);
    1 row created.
    jeff@ORA10GR2> insert into tableb values (0072385, 'SE', 5660249);
    1 row created.
    jeff@ORA10GR2> insert into tableb values (0073215, 'SE', 5660249);
    1 row created.
    jeff@ORA10GR2> insert into tableb values (0084797, 'SE', 5660249);
    1 row created.
    jeff@ORA10GR2> insert into tableb values (0091375, 'SE', 5660249);
    1 row created.
    jeff@ORA10GR2>
    jeff@ORA10GR2> create table tablec
    2 (id_inst number
    3 ,id_isin varchar2(20)
    4 );
    Table created.
    jeff@ORA10GR2>
    jeff@ORA10GR2> insert into tablec values (0029010, 'FR0000120172');
    1 row created.
    jeff@ORA10GR2> insert into tablec values (0070789, 'FR0000120172');
    1 row created.
    jeff@ORA10GR2> insert into tablec values (0071190, 'FR0000120172');
    1 row created.
    jeff@ORA10GR2>
    jeff@ORA10GR2>      select tb.id_inst_xref, tc.id_isin
    2      from tableb tb, tablec tc
    3      where tb.id_inst = tc.id_inst;
    ID_INST_XREF ID_ISIN
    5660249 FR0000120172
    5660249 FR0000120172
    5660249 FR0000120172
    jeff@ORA10GR2>
    jeff@ORA10GR2> select ta.id_entity,ta.inst_code,ta.dt_trade,dt.id_isin,count(*)
    2 from tablea ta,
    3      (select tb.id_inst_xref, tc.id_isin
    4      from tableb tb, tablec tc
    5      where tb.id_inst = tc.id_inst) dt
    6 where ta.inst_code = dt.id_inst_xref
    7 group by ta.id_entity,ta.inst_code,ta.dt_trade,dt.id_isin;
    ID_ INST_CODE DT_TRADE ID_ISIN COUNT(*)
    AGL 5660249 05/FEB/06 FR0000120172 3
    AGL 5660249 01/FEB/06 FR0000120172 6
    jeff@ORA10GR2>
    jeff@ORA10GR2> drop table tablea;
    Table dropped.
    jeff@ORA10GR2> drop table tableb;
    Table dropped.
    jeff@ORA10GR2> drop table tablec;
    Table dropped.
    jeff@ORA10GR2>
    jeff@ORA10GR2> spool off

  • Query Performance Please Help

    Hi can any body tell me how do I improve the performance of this query.This query takes forever to execute.
    PLEASE HELP
    select substr(d.name,1,14) "dist",
    sum(r.room_net_sq_foot) "nsf",
    sum(r.student_station_count) "sta",
    sum(distinct(r.cofte)) "fte"
    from b_fish_report r,
    g_efis_organization d
    where substr(r.organization_code,-2,2) = substr(d.code,-2,2) and
    d.organization_type = 'CNTY' and
    r.room_satisfactory_flag = 'Y' and
    substr(d.code,-2,2) between '01' and '72'
    -- rownum < 50
    group by d.name, r.organization_code
    order by d.name
    It has nonunique Indexes on Organization code
    Thanks
    Asma.

    Asma,
    I tried your SQL on my tables T1 and T2. Indexes are on C1,C2,C3 and N1,N2,N3. The data in T1 and T2 are shown below with the explain plan (also called EP) listed. You really need to do an explain plan (free TOAD is easiest to do this in) and respond showing your EP results.
    By simply changing the optimizer mode to RULE I was able to get it to use indexes on both T1 and T2.
    T1 data
    C1     C2     C3     N1     N2
    001     Y     AAA     1     11
    002     Y     BBB     2     22
    003     Y     CCC     3     33
    111     N     DDD     4     44
    222     N     EEE     5     55
    333     Y     FFF     6     66
    070     Y     GGG     7     77
    071     N     HHH     8     88
    072     Y     III     9     99
    TEST     TEST     TEST     10     100
    T2 data
    C1     C2     C3     N1     N2
    001     CNTY     AAA     1     11
    002     CNTY     BBB     2     22
    003     CNTY     CCC     3     33
    111     XXX     DDD     4     44
    222     XXX     EEE     5     55
    333     CNTY     FFF     6     66
    070     CNTY     GGG     7     77
    071     XXX     HHH     8     88
    072     CNTY     III     9     99
    TEST     TEST     TEST     10     100
    This is the results when I run the SQL based on this data ...
    dist     nsf     sta     fte
    AAA     1     11     10
    BBB     2     22     20
    CCC     3     33     30
    FFF     6     66     60
    GGG     7     77     70
    III     9     99     90
    --[SQL 1] : with CHOOSE as the optimizer mode, which is normally the DEFAULT if no hint is specified
    select /*+ CHOOSE */
    substr(d.c3,1,14) "dist",
    sum(r.n1) "nsf",
    sum(r.n2) "sta",
    sum(distinct(r.n3)) "fte"
    from t1 r, t2 d
    where substr(r.c1,-2,2) = substr(d.c1,-2,2) and
    d.c2 = 'CNTY' and
    r.c2 = 'Y' and
    substr(d.c1,-2,2) between '01' and '72'
    group by d.c3, r.c1
    order by d.c3
    This is what the EP shows for your SQL (which will probably be the same for you once you do an EP on your actuall sql) ...
    SELECT STATEMENT Optimizer=CHOOSE (Cost=4 Card=1 Bytes=37)
    SORT (GROUP BY) (Cost=4 Card=1 Bytes=37)
    NESTED LOOPS (Cost=2 Card=1 Bytes=37)
    TABLE ACCESS (FULL) OF T1 (Cost=1 Card=1 Bytes=12)
    TABLE ACCESS (BY INDEX ROWID) OF T2 (Cost=1 Card=1 Bytes=25)
    INDEX (RANGE SCAN) OF I_NU_T2_C2 (NON-UNIQUE)
    Notice the FULL table scan of T1 which you don't want, and neither C1 index is getting used (I've explained why below).
    --[SQL 2] : only changed the hint to RULE ...
    select /*+ RULE */
    substr(d.c3,1,14) "dist",
    sum(r.n1) "nsf",
    sum(r.n2) "sta",
    sum(distinct(r.n3)) "fte"
    from t1 r, t2 d
    where substr(r.c1,-2,2) = substr(d.c1,-2,2) and
    d.c2 = 'CNTY' and
    r.c2 = 'Y' and
    substr(d.c1,-2,2) between '01' and '72'
    group by d.c3, r.c1
    order by d.c3
    SELECT STATEMENT Optimizer=HINT: RULE
    SORT (GROUP BY)
    NESTED LOOPS
    TABLE ACCESS (BY INDEX ROWID) OF T2
    INDEX (RANGE SCAN) OF I_NU_T2_C2 (NON-UNIQUE)
    TABLE ACCESS (BY INDEX ROWID) OF T1
    INDEX (RANGE SCAN) OF I_NU_T1_C2 (NON-UNIQUE)
    Though the C2 index is getting used (your r.c2 = 'Y' part in the where clause) the main problem your having here is the JOIN column (C1 in both tables) is not getting used. So the join you have ...
    where substr(r.c1,-2,2) = substr(d.c1,-2,2)
    isn't using an index and you want it too. There are 2 solutions to correct this..
    Solution #1
    The first is to make a function-based index for data. Since your doing SUBSTR on C1 that C1 index does not contain that partial information so it will not use it. Below is the syntax to make a function based index for this partial data ...
    CREATE INDEX I_NU_T1_C1_SUBSTR ON T1 (SUBSTR(C1,-2,2));
    CREATE INDEX I_NU_T2_C1_SUBSTR ON T2 (SUBSTR(C1,-2,2));
    or also this way if it's still not using the above indexes ...
    CREATE INDEX I_NU_T1_C1_SUBSTR ON T1 (SUBSTR(C1,-2,2),C1);
    CREATE INDEX I_NU_T2_C1_SUBSTR ON T2 (SUBSTR(C1,-2,2),C1);
    Solution #2
    The second solution is to make another column in both table and place this 2 digit information in it, and then index this new column. That way the join will look like ...
    where r.c_new_column = d.c_new_column
    and
    r.c_new_column between '01' and '72'
    also with this new column the BETWEEN clause at the end you will not need the substring as well. Also remember BETWEEN on character values is different than numbers.
    Final Notes
    I just tried creating the functional index and I can't get it to be used it for some reason (I might not have the right amount of data), but I really think that is your best option here. As long as it uses the functional index you won't have to change your code. You might want to try using INDEX() in the hint to get it to be used, but hopefully it will use it right away. Try all 4 types of optimizer modes (CHOOSE, RULE, ALL_ROWS, FIRST_ROWS) in your primary hints to see if it will use the new function-based index.
    You really do need to get explain plan going. Even if you make these functional indexes you won't know if its going to be using them until you look at the EP results. You can do EP manually (the SQL of how to produce the results is in OTN, though I find free TOAD is by far the easiest) and you will still need to have run the utlxplan.sql script. Oracle I do think has some GUI tools, maybe in OEM, that have explain plan built in as well.
    I hope this helps ya,
    Tyler D.

  • ABAP QUERY REPORT : please help me ASAP.

    hi friends,
    I need to change the existing custom abap query.
    1) I need to add two more fields on selection screen. I have added using INFOSET and checked the input and output check boxes.
    But the text of the one field should be different from standard tetx.
    "Reference date" to be changed to "Dairy date".
    I have changed in Infosets. updated text is displaying as "Dairy date" in the out put LIST, but standard text (Reference date) is appearing on the selection screen.
    I need it to be displaed as "Dairy date"
    2)The column "Dairy" date is adding as the last column in the list after executing the query. But I need it to be displayed at 8th column.
    Please help me ASAP.

    hi Eric,
    Could you please explain in detail.
    1)I HAVE CHANGED THE NAME IN iNFOSET, FIELD GROUP.
    IT IS NOT REFLECTING IN SELECTION SCREEN. ONLY REFLECTING IN THE OUT  PUT.
    2) I have tried by changing the sort sequence number. but still it is displaying at the end of the columns.
    please explain in detail.

  • Sql  Query . Please help its urgent.

    Suppose in table EMP there are 2 columns (Roll_no and Name)
    Roll NO Name
    00001 A
    00002 B
    00010 X
    My requirement is to trunc preceding Zero's. For ex : for Roll no: 00001 the output should be 1 and for 00002 --> 2 .
    Please help its very urgent.

    try this
          select
                  to_number(roll_no) roll_no,
                  name
          from
                  emp;
         Regards
    Singh

  • SQL QUERY, URGENT PLEASE HELP .....

    Hi,
    There is a table which stores the sales record, weekly basis.
    For example
    WEEK______ ITEMNO______SALES______QTY
    200201_____10001______10,000______50
    200202_____10001______18,000______55
    200230_____10001______55,000_____330
    Now the report should display the week nos and a Cumulative average.
    like
    ITEM NO - 10001
    WEEKNO____WK-AVG____13WK-AVG____26WK-AVG____52WK-AVG
    200201
    200202
    200203
    200230
    The WK-AVG is calculated for that perticular (weeks sales /weeks qty) but for 13WK-AVG,26-AVG and 52WK-AVG , The calculationis the (cumulative of last 13 week sales /cumulative of last 13 wk qty)
    for example at week 200230 the 13WK-AVG should be
    (cumulative sales from week 200218 to 200230 / cumulative qty from week 200218 to 200230 )
    the same hold good for 26WK-AVG AND 52WK-AVG. Please suggest me how to do it . This is very urgent . Please help me .
    Thanks
    Feroz

    Feroz,
    One way is to use subselects. E.g.,
    SELECT WK_AVG, 13WK_AVG, 26WK_AVG, 56WK_AVG FROM
    (SELECT (SALES/QTY) AS WK_AVG FROM TABLE WHERE ITEMNO=x AND WEEK = ...),
    (SELECT (SUM(SALES)/SUM(QTY)) AS 13WK_AVG WHERE ITEMNO=X AND WEEK > Y AND WEEK <= Z),
    hope this helps.
    regards,
    Stewart

  • Connection query. Please Help

    My set up is....
    BT line to Orange livebox. (wireless turned off)
    livebox to TC (cat 5 cables)
    TC to PC (not being backed up, Ethernet to provide net access)
    Wireless to iMac. 802.11n (b/g compatible)
    Internet dropouts, can't find server messages, you are not connected to the Internet, & such, are becoming the bain of my life.
    So someone please help. The airport signal from TC in the menu bar is always strong, so how can I have lost the Internet?? Is it possible to loose the Internet but still have a full signal in airport? Where is the weak link? Time Capsule? Cable from livebox to TC? or is this a livebox/orange (ISP) issue??

    Hi, settings has follows...
    Internet Connection
    Connect Using: Ethernet
    Configure IPv4: Using DHCP
    IP Address: 192.. (Same as Livebox IP) Although TC has its own on the first page you come to when launching APU.
    Subnet Mask: as livebox
    Router Address: as livebox
    DNS Server: as livebox
    Domain Name (blank)
    DHCP Client ID: (blank)
    Ethernet WAN Port: Automatic (Default)
    Connection Sharing: Share a public IP address
    DHCP
    DHCP Beginning Address: 10.0.1.2
    DHCP Ending Address:10.0.1.200
    DHCP Lease: 4 hours
    The rest are blank
    NAT
    NAT port mapping is enabled
    Funny thing is the internet connection has been very reliable since last thursday, I looked in the APU when the connection fell & got messages about an unreliable IP address, cant remember the exact message. Also got double NAT errors in the Console! But as i say no trouble since, but I dread it happening again & think its going to any minute.
    Thanks for your help.

  • Need example for BAPI query. Please, help.

    Hi,
    badly need help on BAPI_ACC_ACTIVITY_ALLOC_POST.
    Does anybody have some example code for jCO query?
    Thanks.
    Vladimir

    Hi,
    Try this code...
    package jco;
    import com.sap.mw.jco.*;
    public class jcosample
       public static void main(String args[])
           JCO.Client myConnection = null;
           JCO.Repository mRepository = null;
           JCO.Function myFunction = null;
           try
           myConnection = JCO.createClient("client","username","password" ,"language","ip address","system no");           
           myConnection.connect();
           mRepository = new JCO.Repository("WIPRO",myConnection);
           try
                  if (mRepository == null )
                         System.out.println("NuLL");
                  try
                         IFunctionTemplate ft=mRepository.getFunctionTemplate("BAPI_COMPANYCODE_GETLIST");                                                 
                         myFunction=ft.getFunction();                    
                  }catch (Exception ex)
                         throw new Exception(ex + "Problem retrieving JCO.Function object.");
            if (myFunction == null)
                     System.exit(1);
                  myConnection.execute(myFunction);                                  
                  }catch (Exception ex)
                         ex.printStackTrace();
                         System.exit(1);
                myConnection.execute(myFunction);
                JCO.Table codes = null;
                  codes =myFunction.getTableParameterList().getTable("COMPANYCODE_LIST");
                  int size;
                 size =codes.getNumRows();
                  if (size == 0)
                      System.out.println("No value matches the selection cretaria");
                  else
                     for (int i = 0;i<=size; i++)
                            codes.setRow(i);                      System.out.print(codes.getString("COMP_CODE"));                     System.out.println(codes.getString("COMP_NAME"));
           }catch( Exception e)
                  e.printStackTrace();
    Hope that helps...
    Note: in case for the BAPI that inserts or modified data you must call the BAPI_TRANSACTION_COMMIT also for the changes to get reflected in the Database.
    Please let me if that helps you.
    Cheers
    Kathir~

  • Enter query problem -please help

    Hello guys,
    Currently i am facing one problem.I have a from which is showing first three cols of emp table(empname,empno,dept).The form has one button.When user is pressing that button user can see more information about the employee.The form which is showing the details of the employees is a new form.This form has another button called return.When user is pressing that button the user can see first form.
    In the return button i have written the code
    exit_form.
    but the problem is after returning to the the form when i am pressing the enter query button it is throwing the error
    41003-this function can not be performed here.
    But after clicking on emprow when i am pressing enter query button it is running fine.
    Can anybody please tell me how can i use enter query button without clicking on the empno row.
    Thanks
    Rajat

    Rajat,
    Sounds like when you exit your detail form the focus is not returned to a database block/item. In order to enter "Query" mode, the focus must be on a "Queryable" item. One solution would be to code your Form level Execute-Query trigger to move the focus to the EMP block and then execute_query(). For example:
    BEGIN
       GO_BLOCK('EMP');
       EXECUTE_QUERY();
    END;Hope this helps.
    Craig...
    -- If my response or the response of another is helpful or answers your question please mark the response accordingly. Thanks!

  • How to optimize this query? Please help

    i have one table(argus) having 80,000 rows and another table (p0f) having 30,000 rows and i have to join both table on the basis of time field. the query is as follows
    select distinct(start_time),res.port, res.dst_port from (select * from argus where argus.start_time between '2007-06-13 19:00:00' and '2007-06-22 20:00:00') res left outer join p0f on res.start_time=p0f.p0f_timestamp ;
    the query is taking very large time . i have created index on the start_time and p0f_timestamp ,it increased the performance but not so much. My date comparisons would vary every time i have to execute a new query.
    Plz tell me is there another way to execute such a query to output same results?
    plz help me as my records are increasing day by day
    Thanks
    Shaveta

    From my small testcase it seems that both queries are absolute identical and don't actually take too much time:
    SQL> create table argus as (select created start_time, object_id port, object_id dst_port from all_objects union all
      2                         select created start_time, object_id port, object_id dst_port from all_objects)
      3  /
    Table created.
    SQL> create table p0f as select created p0f_timestamp, object_id p0f_port, object_id p0f_dst_port from all_objects
      2  /
    Table created.
    SQL> create index argus_idx on argus (start_time)
      2  /
    Index created.
    SQL> create index p0f_idx on p0f (p0f_timestamp)
      2  /
    Index created.
    SQL>
    SQL> begin
      2   dbms_stats.gather_table_stats(user,'argus',cascade=>true);
      3   dbms_stats.gather_table_stats(user,'p0f',cascade=>true);
      4  end;
      5  /
    PL/SQL procedure successfully completed.
    SQL>
    SQL> select count(*) from argus
      2  /
      COUNT(*)
         94880
    SQL> select count(*) from p0f
      2  /
      COUNT(*)
         47441
    SQL>
    SQL> set timing on
    SQL> set autotrace traceonly explain statistics
    SQL>
    SQL> select distinct (start_time), res.port, res.dst_port
      2             from (select *
      3                     from argus
      4                    where argus.start_time between to_date('2007-06-13 19:00:00','RRRR-MM-DD HH24:MI:SS')
      5                                               and to_date('2007-06-22 20:00:00','RRRR-MM-DD HH24:MI:SS')) res
      6                  left outer join
      7                  p0f on res.start_time = p0f.p0f_timestamp
      8                  ;
    246 rows selected.
    Elapsed: 00:00:02.51
    Execution Plan
    Plan hash value: 1442901002
    | Id  | Operation               | Name    | Rows  | Bytes |TempSpc| Cost (%CPU)| Time     |
    |   0 | SELECT STATEMENT        |         | 21313 |   520K|       |   250   (6)| 00:00:04 |
    |   1 |  HASH UNIQUE            |         | 21313 |   520K|  1352K|   250   (6)| 00:00:04 |
    |*  2 |   FILTER                |         |       |       |       |            |          |
    |*  3 |    HASH JOIN RIGHT OUTER|         | 21313 |   520K|       |    91  (11)| 00:00:02 |
    |*  4 |     INDEX RANGE SCAN    | P0F_IDX |  3661 | 29288 |       |    11   (0)| 00:00:01 |
    |*  5 |     TABLE ACCESS FULL   | ARGUS   |  7325 |   121K|       |    79  (12)| 00:00:01 |
    Predicate Information (identified by operation id):
       2 - filter(TO_DATE('2007-06-13 19:00:00','RRRR-MM-DD
                  HH24:MI:SS')<=TO_DATE('2007-06-22 20:00:00','RRRR-MM-DD HH24:MI:SS'))
       3 - access("ARGUS"."START_TIME"="P0F"."P0F_TIMESTAMP"(+))
       4 - access("P0F"."P0F_TIMESTAMP"(+)>=TO_DATE('2007-06-13 19:00:00','RRRR-MM-DD
                  HH24:MI:SS') AND "P0F"."P0F_TIMESTAMP"(+)<=TO_DATE('2007-06-22
                  20:00:00','RRRR-MM-DD HH24:MI:SS'))
       5 - filter("ARGUS"."START_TIME">=TO_DATE('2007-06-13 19:00:00','RRRR-MM-DD
                  HH24:MI:SS') AND "ARGUS"."START_TIME"<=TO_DATE('2007-06-22 20:00:00','RRRR-MM-DD
                  HH24:MI:SS'))
    Statistics
              1  recursive calls
              0  db block gets
            304  consistent gets
              0  physical reads
              0  redo size
           7354  bytes sent via SQL*Net to client
            557  bytes received via SQL*Net from client
             18  SQL*Net roundtrips to/from client
              0  sorts (memory)
              0  sorts (disk)
            246  rows processed
    SQL>
    SQL> select distinct start_time, port, dst_port
      2             from argus left outer join p0f on start_time = p0f_timestamp
      3            where start_time between to_date ('2007-06-13 19:00:00','RRRR-MM-DD HH24:MI:SS')
      4                                       and to_date ('2007-06-22 20:00:00','RRRR-MM-DD HH24:MI:SS')
      5  /
    246 rows selected.
    Elapsed: 00:00:02.47
    Execution Plan
    Plan hash value: 1442901002
    | Id  | Operation               | Name    | Rows  | Bytes |TempSpc| Cost (%CPU)| Time     |
    |   0 | SELECT STATEMENT        |         | 21313 |   520K|       |   250   (6)| 00:00:04 |
    |   1 |  HASH UNIQUE            |         | 21313 |   520K|  1352K|   250   (6)| 00:00:04 |
    |*  2 |   FILTER                |         |       |       |       |            |          |
    |*  3 |    HASH JOIN RIGHT OUTER|         | 21313 |   520K|       |    91  (11)| 00:00:02 |
    |*  4 |     INDEX RANGE SCAN    | P0F_IDX |  3661 | 29288 |       |    11   (0)| 00:00:01 |
    |*  5 |     TABLE ACCESS FULL   | ARGUS   |  7325 |   121K|       |    79  (12)| 00:00:01 |
    Predicate Information (identified by operation id):
       2 - filter(TO_DATE('2007-06-13 19:00:00','RRRR-MM-DD
                  HH24:MI:SS')<=TO_DATE('2007-06-22 20:00:00','RRRR-MM-DD HH24:MI:SS'))
       3 - access("START_TIME"="P0F_TIMESTAMP"(+))
       4 - access("P0F_TIMESTAMP"(+)>=TO_DATE('2007-06-13 19:00:00','RRRR-MM-DD
                  HH24:MI:SS') AND "P0F_TIMESTAMP"(+)<=TO_DATE('2007-06-22 20:00:00','RRRR-MM-DD
                  HH24:MI:SS'))
       5 - filter("ARGUS"."START_TIME">=TO_DATE('2007-06-13 19:00:00','RRRR-MM-DD
                  HH24:MI:SS') AND "ARGUS"."START_TIME"<=TO_DATE('2007-06-22 20:00:00','RRRR-MM-DD
                  HH24:MI:SS'))
    Statistics
              1  recursive calls
              0  db block gets
            304  consistent gets
              0  physical reads
              0  redo size
           7354  bytes sent via SQL*Net to client
            557  bytes received via SQL*Net from client
             18  SQL*Net roundtrips to/from client
              0  sorts (memory)
              0  sorts (disk)
            246  rows processedCan you show us a similar testcase with explain plan and statistics?

  • Query problem  please help

    Hi,
    i' ve  a  problem with a  query:  i  want  to  see  only  serial  number  with  a  Credit  notes  but  i'm  not  able  to  complete  them:  this is  the  query
    SELECT T0.[ItemCode], T0.[ItemName], T1.[IntrSerial] FROM SRI1 T0  INNER JOIN OSRI T1 ON T0.SysSerial = T1.SysSerial WHERE T0.[BaseType]  = 14 and   T1.[Status]  = '0'
    Help  me  thanks. 
    regards

    Hi
    It is difficult when we don't know what you are looking for
    SELECT T0.ItemCode, T0.ItemName, T1.IntrSerial FROM SRI1 T0 INNER JOIN OSRI T1 ON T0.SysSerial = T1.SysSerial WHERE T0.BaseType = 14 and T1.Status = '0'
    Your query seems fine as you are referring from Basetype =14  . I am not sure about Status
    Status ='0'  and 0 is numeric value here and not alphabhet O
    Status =1 means unavailable
    Thank you
    Bishal

  • Query  doubt - Please Help

    Sir,
    I am having a table like following
    Deptno job
    10 aaa
    11 bbb
    12 ccc
    10 ddd
    11 eee
    12 ffff
    10 ggg
    in the above table I want the out put like following in a single query ,is it possible.
    10 aaa,ddd,ggg (concatenation of all jobs under that particular deptno)
    11 bbb,eee
    12 ccc,ffff
    Regards,
    Mathew

    Sir,
    I am not able to cutomize my requirement using this,
    SQL> select col1, col2,
    2 substr(max(substr(sys_connect_by_path (col3||' '||
    3 col4, ', '),2)),1,60)
    4 as col3
    5 from tab1
    6 start with col4 = 1
    7 connect by col4 = prior col4 + 1
    8 and prior col1 = col1
    9 and prior col2 = col2
    10 group by col1, col2;
    plz help me.
    regards
    Mathew

  • SQL Query Problem - Please Help

    Post Author: nmellick
    CA Forum: Data Connectivity and SQL
    Hello,
    I am trying to use a query in CR9 to pull the latest date of a DREXAM for each patient.  The patient can have one item or several items.  When I run this query, it only pulls back one record, the latest DREXAM from the whole table, not by patients.  I need it by patients (tracking_id is the patient_id).  Any ideas on what I'm doing wrong?
    Here is the query:select t.tracking_id, t.tracking_group_cd, t.track_event_id, t.requested_dt_tm, t.complete_dt_tm, te.display_keyfrom V500.TRACKING_EVENT t, v500.track_event tewhere t.track_event_id = te.TRACK_EVENT_IDand te.display_key = 'DREXAM'and t.complete_dt_tm = (select max(complete_dt_tm) "MaxDate" from V500.TRACKING_EVENT t, v500.track_event te                        where t.track_event_id = te.TRACK_EVENT_ID                        and te.display_key = 'DREXAM');
    Note:  The tracking_id field shows by patient.  When I run everything up to the last "and" (the complete date), it pulls all rows, which may be more than one per patient.  Basically, I just want the latest DREXAM row per patient.
    Thanks!

    Try to escape the special character '%' using '\%'.

  • Error Executing Database Query. (Please help)

    I can't get this query to work properly. I have gone over it so many times.. I can't count, I don't get why it's throwing an error. Here is my code, and followed by the error:
    My update query:
    <cfquery name="UpdateDetails" datasource="#APPLICATION.dataSource#">
    UPDATE books234
    SET
    books234.title=<cfqueryparam cfsqltype="cf_sql_varchar" value="#form.title#">,
    books234.info=<cfqueryparam cfsqltype="cf_sql_varchar" value="#form.info#">,
    books234.statement=<cfqueryparam cfsqltype="cf_sql_varchar" value="#form.statement#">,
    <cfif fileuploaded is true>
    books234.MYFile=<cfqueryparam cfsqltype="cf_sql_varchar" value="#uploadedfile#">,
    </cfif>
    books234.links=<cfqueryparam cfsqltype="cf_sql_varchar" value="#form.links#">,
    books234.ordNum=<cfqueryparam cfsqltype="cf_sql_varchar" value="#form.ordNum#">
    WHERE books234.ID = <cfqueryparam value="#form.ID#" cfsqlType="CF_SQL_INTEGER">
    </cfquery>
    <cflocation url="bookView.cfm?ID=#Form.ID#" addtoken="no">
    Here is my error:
    Error  Executing Database Query.
    [Macromedia][SequeLink JDBC  Driver][ODBC Socket][Microsoft][ODBC Microsoft Access Driver]Invalid precision  value
    The  error occurred in C:\websites\209689jh6\slideAction.cfm: line  455
    Called from C:\websites\209689jh6\admin\cms\slideAction.cfm:  line 442
    Called from C:\websites\209689jh6\admin\cms\slideAction.cfm:  line 390
    Called from C:\websites\209689jh6\admin\cms\slideAction.cfm:  line 1
    Called from C:\websites\209689jh6\admin\cms\slideAction.cfm:  line 455
    Called from C:\websites\209689jh6\admin\cms\slideAction.cfm:  line 442
    Called from C:\websites\209689jh6\admin\cms\slideAction.cfm:  line 390
    Called from C:\websites\209689jh6\admin\cms\slideAction.cfm:  line 1
    453 : books234.links=<cfqueryparam cfsqltype="cf_sql_varchar" value="#form.links#">,
    454 : books234.ordNum=<cfqueryparam cfsqltype="cf_sql_varchar" value="#form.ordNum#">
    455 : WHERE books234.ID = <cfqueryparam value="#form.ID#" cfsqlType="CF_SQL_INTEGER">
    456 : </cfquery>
    457 : <cflocation url="bookView.cfm?ID=#Form.ID#" addtoken="no">
    Can anyone see what I did wrong here? It's not like it's a sophisticated query. I write these all the time.
    Thank you.

    Does it work without using cfqueryparam in the WHERE statement?  Are you sure the type CF_SQL_INTEGER is correct?  Is the value of form.ID really an integer?
    Cheers

Maybe you are looking for

  • IP Profile and lots of Errors

    Hi folks, a few weeks ago i phoned up about my speed and was told that my IP Profile was stuck, after the usual 10 days it was still stuck so i called again and they tried to reset again and i have waited again and it is still at 2MB, This was over t

  • How do I add Firefox to my docking station so I don't have to open every time I click on the icon?

    Firefox 3.6 was on my docking station on my mac all this time. When I saw the pop up for Firefox 4 and its features, I downloaded v.4 this morning but when I try to open the browser, I always have to go through the same step of "opening" the newer ve

  • Anonymous access to XML Form Builder file

    Hi to all I create a XML Form Builder project to create a method for news publishing. I use an KM navigation iview tath containing XML file. If i authenticate me on the portal i view all correctly. the problem is with anonymous user, the portal requi

  • Naming pics in an album

    I'm new to iPhoto. I have hundreds of pics from a recent vacation. I believe I understand the concept of albums and keywording; however I would like to have many pictures labeled so others viewing them will know what they are of, town they are in, sp

  • Paramater Criteria not selecting correct data

    Why oh why would disco do this I have a field configured in the EUL to a format mask of "Mon" it shows a truncated date field with Jan, Feb, Mar etc... When I put selection criteria on the field to only display JAN it brings back the columns with Jan