sum sql select help

Hello.
In a table, I keep product_id, sale_date, amount order_id

How is possible to select the County (order_id) and flat per day in a month
but visible every day in a month

Concerning
ARIS DC

To view all the days of March, even if no sale is present for a few days:

select to_char(sale_date,'dd-mm-yyyy') day, count(order_id), sum(amount)
from yourtable,
     (select to_date('20100301','yyyymmdd')+level-1 mydate
        from dual
      connect by level <= to_date('20100331','yyyymmdd')-to_date('20100301','yyyymmdd')+1) dates
where sale_date(+) = mydate
group by to_char(sale_date,'dd-mm-yyyy')

Max
http://oracleitalia.WordPress.com

Tags: Database

Similar Questions

  • SQL - select Help - box When? Return value of the second Table?

    -Next to people on this forum I am probably somewhere between a beginner and an intermediate SQL user.

    Ive been using a case when stated in plsql to find "all who has status in any program was canceled during a specific time, but have become or are still active in another program"

    So, Im actually trying to return a value from another table in a case where, but this isn't anthing taste other than a text declared as 'Yes' or 'no '.

    This is the select statement - y at - it another way to do it where I can get the results I need?

    -case when pp.party_id in (select pp1.party_id - cancelled active clients in another program)

    of asa.program_participation pp1,.

    ASA.curr_prog_participation_status cpps1

    where pp1.program_participation_id = cpps1.program_participation_id

    and pp1.party_id = pp.party_id

    and cpps1.code_value = 'Act')

    So 'Yes' is still 'No' end as Active_in_Other_Prg

    So - instead of 'Yes', I want essentially the program they are active or pp1.program_id, another null

    It is possible that the client can be active in more than one program as well.

    Any help is greatly appreciated, I explored with if and decodes but I can't get anything to work.

    Ben

    Looks like an outer join. See doc ora: joins at

    Select p

    q.party_id

    q.program_id

    of table_with_party_id p

    , (select pp1.party_id - cancelled active clients in another program)

    pp1.program_id

    of asa.program_participation pp1,.

    ASA.curr_prog_participation_status cpps1

    where pp1.program_participation_id = cpps1.program_participation_id

    and pp1.party_id = pp.party_id

    and cpps1.code_value = 'ACT') q

    where p.party_id = q.party_id (+)

    Note: In the example above shoudn't it be a space between the (and +), but the forum software automatically converts to

    The outer join will connect display all records in the table p and q records only if fits the party_id, IE q.party_id and q.program_id will be null if there is no match.

    Edit: adding program_id

  • SQL Count helps

    Hello world

    I need to display the SPER_STATUS_TEXT count as 0 if there is no data from query below. Could someone help me please

    SQL > SELECT a.sper_status_text, COUNT (*)
    2 from (SELECT sper.assettxt,
    CASE 3
    4. WHEN sper.sper_status_text = "assessment" said.
    5 THEN
    6 'confirmed assessment '.
    7. WHEN sper.sper_status_text AS "update - rated %".
    8 THEN
    9 "update - rated up to."
    10. WHEN sper.sper_status_text AS "update - % evaluated.
    11. CAN
    12 'update - rated down"
    13 ELSE
    14 "other responses.
    15 END
    16 sper_status_text
    17 zzcus.zzcus_sper_data sper
    18 WHERE sper.sper_dates = ' 20100801-20100831'
    19 AND sper.customer_id = 'NATFINS. '
    20 AND sper.task_inquiry_type = "Vendor Comparison"
    21 AND sper.assettxt <>'! MAD
    (22) a
    23 GROUP BY a.sper_status_text
    ORDER 24 (CASE
    25. WHEN a.sper_status_text = "Said assessment" THEN 1
    26. WHEN a.sper_status_text = "update - evaluated until ' THEN 2
    27. WHEN a.sper_status_text = 'Update - rated down' THEN 3
    28 4 SOMETHING ELSE
    END 29);

    Results:
    SPER_STATUS_TEXT COUNT (*)
    ------------------------ ----------
    Claims assessment 2

    I need to display as below (if there no data I need to display the number as 0)
    SPER_STATUS_TEXT COUNT (*)
    ------------------------ ----------
    Claims assessment 2
    Updated - evaluated up to 0
    Updated - rated low 0
    Other answers 0

    Please advice

    You can get this. Using the TYPE clause.

    SQL>
    SQL> CREATE TABLE ZZCUS_SPER_DATA1
      2  (
      3     SPER_STATUS_TEXT VARCHAR2 (30)
      4    ,TASK_INQUIRY_TYPE VARCHAR2 (100)
      5  );
    
    Table created.
    
    SQL>
    SQL> INSERT INTO ZZCUS_SPER_DATA1
      2       VALUES (
      3                 'Data Updated', 'Descriptive Data Challenge - Maturity date / Redemption date');
    
    1 row created.
    
    SQL>
    SQL> INSERT INTO ZZCUS_SPER_DATA1
      2       VALUES ('Data Updated', 'Descriptive Data Challenge - Ticker / Local Code');
    
    1 row created.
    
    SQL>
    SQL> SELECT *
      2    FROM (  SELECT A.SPER_STATUS_TEXT, COUNT (*) CNT
      3              FROM (SELECT CASE
      4                              WHEN SPER.SPER_STATUS_TEXT = 'Data Confirmed'
      5                              THEN
      6                                 'Data Item Confirmed'
      7                              WHEN SPER.SPER_STATUS_TEXT LIKE 'Data Updated'
      8                              THEN
      9                                 'Data Item Updated'
     10                              ELSE
     11                                 'Other Responses'
     12                           END
     13                              SPER_STATUS_TEXT
     14                      FROM ZZCUS_SPER_DATA1 SPER
     15                     WHERE 1 = 1
     16                           AND SPER.TASK_INQUIRY_TYPE LIKE 'Descriptive Data Challenge%') A
     17          GROUP BY A.SPER_STATUS_TEXT
     18          ORDER BY (CASE
     19                       WHEN A.SPER_STATUS_TEXT = 'Data Item Confirmed' THEN 1
     20                       WHEN A.SPER_STATUS_TEXT = 'Data Item Updated' THEN 2
     21                       WHEN A.SPER_STATUS_TEXT = 'Other Responses' THEN 3
     22                       ELSE 4
     23                    END))
     24  MODEL
     25     DIMENSION BY (SPER_STATUS_TEXT)
     26     MEASURES (CNT)
     27     RULES
     28        (CNT ['Data Item Confirmed'] = NVL (CNT[CV ()], 0),
     29        CNT ['Data Item Updated'] = NVL (CNT[CV ()], 0),
     30        CNT ['Other Responses'] = NVL (CNT[CV ()], 0));
    SPER_STATUS_TEXT           CNT
    ------------------- ----------
    Data Item Updated            2
    Other Responses              0
    Data Item Confirmed          0
    
    3 rows selected.
    
    SQL> 
    

    G.

  • What is the sql SELECT statement to list all service names in the database?

    What is the sql SELECT statement to list all service names in the database?

    I tried
    SELECT name FROM dba_services
    But a long with valid service, he list also some other documents that are not the names of services.

    Hello

    You can try this query:

    select name, value from v$parameter where name = 'service_names';
    

    Hope this helps.
    Best regards
    Jean Valentine

  • SQL SELECT statement as a parameter in the procedure of string

    Hi all

    I'm new to PL/SQL and I must get a procedure as parameter select SQL select statement as a VARCHAR and the production output the result of the statement with a few changes. Can someone help me solve this problem?

    A possibility I thought at was to use a REF CURSOR. The following example works but binds me to a specific table (in the example of the "customers" table). However, I need the ability to specify arbitrary tables in the select statement parameter.
    SET SERVEROUTPUT ON
    DECLARE
      TYPE my_cur IS REF CURSOR;
      query_cursor my_cur;
    BEGIN
      OPEN query_cursor FOR 'SELECT * FROM customers';
      DECLARE
        record_type customers%ROWTYPE;
      BEGIN
         LOOP
            FETCH query_cursor INTO record_type;
            EXIT WHEN query_cursor%NOTFOUND;
            DBMS_OUTPUT.PUT_LINE('some output ... ');
         END LOOP;
      END;
      CLOSE query_cursor;
    END;
    /
    My idea was to modify this example to work in the following code, but it does not work (I get a compile error):
    SET SERVEROUTPUT ON
    DECLARE
      TYPE my_cur IS REF CURSOR;
      query_cursor my_cur;
    BEGIN
    
      OPEN query_cursor FOR 'SELECT * FROM customers';
    
      DECLARE
        record_type query_cursor%ROWTYPE;
      BEGIN
         LOOP
            FETCH query_cursor INTO record_type;
            EXIT WHEN query_cursor%NOTFOUND;
            DBMS_OUTPUT.PUT_LINE('some output ... ');
         END LOOP;
      END;
      
      CLOSE query_cursor;
    
    END;
    /
    Does anyone has an idea how can I solve my problem?

    Thank you very much!
    (I'm using Oracle 11 g)

    This can help.
    Re: Dynamic Extraction on dynamic Sql

  • When I select Help and support icon, I get an error message indicating that the feature could not start.

    help and support does not work

    When I select Help and support icon, I get an error message indicating that the feature could not start.

    I use a Vista 32 bits on a HP computer operating system model number m8300f.

    In addition, I bought a copy of Win 7, but who could not load freezing during installation.

    Hello

    Try to run the command in the elevated command prompt, follow the steps below, it could help us solve the problem.

    1. open the start menu, click programs principally made, select accessories.
    2. right click on command prompt, and then click "run as administrator ".
    3. type the following commands in the DOS prompt window and press ENTER at the end
    of each line:

    REGSVR32 MSXML3. DLL/U
    REGSVR32 MSXML3. DLL
    REGSVR32 MSXML6. DLL/U
    REGSVR32 MSXML6. DLL

    (At the elevated command prompt command should not give us any error).

    Restart the computer and try to access help and Support.

    For the problem of installation of windows 7.

    We would like to get more information about you to help solve your problem. You better, please answer the following questions.

    1. How did you start the installation process?

    2. you perform a new installation or an upgrade?

    3. what type of drive you are using for installation?

    4. at what stage of the installation has it stopped?

    5. have you received an error message?

    First of all, I would say that you disconnect external devices connected to the computer except the keyboard and mouse.

    If you have performed an upgrade suggests to restart the computer and you will be prompted for a roll back option.

    Once you're on the office suggests to run Upgrade Advisor and check what needs to be done before you start the upgrade.

    Before you begin the upgrade process to ensure that your computer meets the condition of equipment to install Windows 7 and check on the website of manufacturer computer if the computer is good to run windows 7 or not.

    Installing and reinstalling Windows

    http://Windows.Microsoft.com/en-us/Windows7/installing-and-reinstalling-Windows

  • A loop using the SQL select query.

    Hello

    I wanted to know, if the concept of loop is possible thanks to the SQL select statement.

    For example
    =======

    Table T1

    Col1 Col2
    Slim 10

    I want to write a query in such a way, so that when I get the result of the query, I format below.

    Col1 Col2
    Slim 10
    Slim 10
    Slim 10

    Basically what I'm trying to achieve is, I have a table with two columns and it has a single line displayed above.

    I want to display this line several times as the output of my SELECT query.

    Let me know, if this target is achievable.

    Kind regards
    Saurabh

    Like this?

    SQL> SELECT 10 col1, 'Sourabh' col2
      2    FROM DUAL
      3  CONNECT BY LEVEL <= 3;
    
          COL1 COL2
    ---------- -------
            10 Sourabh
            10 Sourabh
            10 Sourabh
    
    SQL> 
    
  • Strategic review of using Pro * C package vs embedded SQL Select

    Hello
    I have an old application package.procedure that I'm looking using proC call to get the necessary data through Oracle Package.Procedure. Real call to the package see below, 1 parameter, released as a REF Cursor, SQL Select is simple-nothing fancy.

    I was wondering what might be the benefits (if any) to do that instead of coding real SQL Select into my proC code?
    In the case of any change, you need to change the proC and body package, rather than just do it in place if used directly?

    Source control, PM, nice structure inside of the Oracle, departmental approach just? Everyone at least one list?

    Appreciate your opinion, thank you all.



    Trent

    ----------------
    DECLARE
    number of in_idryba2;
    SIA OUT_LIST. UP_CRUD_ryba. SOR_LIST;
    RLIST SIA.t_ryba%ROWTYPE;
    BEGIN
    IN_IDryba2: = 2;
    SIA. UPK_CRUD_ryba. USP__GETLIST_01 (in_idryba2 = > in_idryba2, OUT_LIST = > OUT_LIST);
    LOOP
    EXTRACT THE OUT_LIST IN RLIST;
    WHEN THE EXIT OUT_LIST % NOTFOUND;
    DBMS_OUTPUT. PUT_LINE ("ID ='|") RLIST.ID_ryba |' DESCRP =' | RLIST. SRIPT);
    END LOOP;

    END;

    Hello

    This is not so much a direct answer to your question, but this thread AskTom discusses some of the advantages to using code in the database and the client.

    http://asktom.Oracle.com/pls/asktom/f?p=100:11:0:P11_QUESTION_ID:30732069210515

    If search you around you can find several other discussions about the same thing.

    The centralization and reusability are two factors that lead me to focus on the code that is stored in the database.

    Kind regards

    Mark

  • NULL in PL/SQL SELECT statement..

    Hi all

    I need to use as a result of a SELECT statement in my function to get PCODE from the table. Cur_rec here. CODE comes from cursor that runs before the declaration.

    SELECT PCODE in v_pcode TABLE_XYZ where CODE = cur_rec. CODE and PCODE = 'VIEW '.


    Now the problem is the part of the CODE has all the information in the table TABLE_XYZ. In this case, it triggers an error NO_DATA_FOUND. To solve it, I can put a part of the EXCEPTION and handle it. But I think in another way...

    If there is no data for a CODE, the default value of v_pcode would be 'No Code'. I tried to use the NVL function, but it does not work here as a SQL SELECT statement.

    Can someone give an idea how to achieve this?

    Hello

    declare
      ...
      v_cnt number;
    begin
      SELECT count(*)
           into v_cnt
          from TABLE_XYZ
        where CODE = cur_rec.CODE
           and PCODE='SEE';
      if v_cnt=0 then
        v_pcode = 'No code';
      else
        v_pcode = 'SEE';
      end if;
    end;
    

    Bartek

  • Join SQL query help

    I have two DEVICE and CONTACT tables. The tables are joined for CONTACT_ID DEVICE_ID. I want to print device_ID and the corresponding coordinates on the lower contact. PRIORITY.
    SQL> describe DEVICE;
    DEVICE_ID              NOT NULL VARCHAR2(50)
    
    SQL> describe CONTACT;
    CONTACT_ID               NOT NULL VARCHAR2(50)
    CONTACT_TYPE             NOT NULL VARCHAR2(4)
    PRIORITY                 NOT NULL DOUBLE PRECISION
    LASTNAME                 NOT NULL VARCHAR2(30)
    FIRSTNAME                NOT NULL VARCHAR2(80)
    
    SQL> SELECT a.DEVICE_ID, b.LASTNAME,b.PRIORITY from DEVICE a, CONTACT b where a.DEVICE_ID = 'DEVICEA' and a.DEVICE_ID=b.CONTACT_ID(+);
    DEVICE_ID              LASTNAME    FIRSTNAME PRIORITY CONTACT_TYPE
    ---------------------- ----------- --------- -------- ------------
    DEVICEA                CONTACT1     GN               1 ROUT
    DEVICEA                CONTACT2     Hans             2 ROUT
    How to print a single record with the CONTACT the lowest. PRIORITY?

    Thank you
    Ravi

    rmalghan wrote:
    Thank you Frank, Sundar and Sean. I had less than 3 to work. Two questions. My table of DEVICES has 31936 records.
    1. the first one returned 30207, 31936 records 2nd and 3rd a 30348. Since the 2nd result resembles what I expected, the 1st and 3rd one seem to miss some records. For troubleshooting, I tried to limit the query to a few devices, but do not understand why the difference. Any suggestions?

    The 2nd query not check for type_contact = 'ROUT', it is not surprising that it returns more rows.
    The request of 3rd fact actually an inner join. The "WHERE c.rnum = 1" condition is applied after the join, so he rejects all rows that have been added due to the outer join (which is where all the columns of c are NULL). You probably meant to say:

    LEFT OUTER JOIN got_rnum c ON  d.DEVICE_ID     = c.CONTACT_ID
                               AND c.rnum          = 1; 
    

    without a WHERE clause.

    2. are there advantages in terms of efficiency. 2nd one does not seem to run faster, so I think it's the best. Any comments?

    SELECT a.DEVICE_ID, b.LASTNAME,b.FIRSTNAME,b.PRIORITY
    FROM DEVICE a, CONTACT b
    where
    a.DEVICE_ID=b.CONTACT_ID(+) and
    b.CONTACT_TYPE = 'ROUT' and
    b.PRIORITY = (select min(b1.PRIORITY ) from CONTACT b1 where b1.CONTACT_ID = b.CONTACT_ID);
    
    30207 rows selected (10.12 seconds)
    
    SELECT DEVICE_ID, LASTNAME, PRIORITY
    FROM (
    SELECT a.DEVICE_ID, b.LASTNAME, b.PRIORITY, ROW_NUMBER() OVER (PARTITION BY a.DEVICE_ID ORDER BY b.PRIORITY) row_num
    from DEVICE a, CONTACT b
    where a.DEVICE_ID=b.CONTACT_ID(+))
    WHERE row_num = 1;
    
    31936 rows selected (6.68 seconds)
    
    WITH got_rnum AS (
    SELECT LASTNAME, FIRSTNAME, PRIORITY, CONTACT_TYPE, CONTACT_ID,
    ROW_NUMBER () OVER ( PARTITION BY  CONTACT_ID ORDER BY priority) AS rnum
    FROM contact
    where CONTACT_TYPE = 'ROUT'
    )
    
    SELECT d.DEVICE_ID, c.LASTNAME, c.FIRSTNAME, c.PRIORITY
    FROM device d
    JOIN got_rnum c ON d.DEVICE_ID     = c.CONTACT_ID(+)
    WHERE c.rnum = 1; 
    
    30348 rows selected (9.07 seconds)
    

    This calendar is not very accurate. One that you run first is likely to be slower, because the data are less likely to be stored in the memory cache.

    The 2nd query has only 3 columns in the result set. Which probably doesn't change the speed a lot, but you should fix it anyway.

  • Select help with sql

    Hello
    could you please help write select sql to retrieve the maximum number of concurrent users, something to check?

    user_id, rec_start, rec_end
    1, 01.10.2009 12:01, 01.10.2009 13:11
    2, 01.10.2009 13:12, 01.10.2009 14:04
    3, 01.10.2009 13:35, 01.10.2009 13:55
    1, 01.10.2009 14:35, 01.10.2009 14:50
    1, 01.10.2009 14:45, 01.10.2009 14:50

    I would like:
    hour, max_of_conc_users
    01.10.2009 12: 1 - no more then 1 user at the same time
    01.10.2009 13: 2 - user_id 2and 3 record at the same time
    01.10.2009 14: 2 - user_id 1 to 2 sessions

    Thank you
    D.

    Hello

    Interesting problem!

    We will change a bit, your sample data for the (total connections per hour) much simpler problem solved by Sven and Hoek has not coincidentally the same results as your problem (the high concurrent users per hour).
    I changed the data of Hoek, adding a line, which has been lgged in for the entire period covered by others:

    CREATE TABLE t as
      select 9 user_id, to_date('01.10.2009 12:01', 'dd.mm.yyyy hh24:mi') rec_start, to_date('01.10.2009 14:49', 'dd.mm.yyyy hh24:mi') rec_end from dual union all
      select 1 user_id, to_date('01.10.2009 12:01', 'dd.mm.yyyy hh24:mi') rec_start, to_date('01.10.2009 13:11', 'dd.mm.yyyy hh24:mi') rec_end from dual union all
      select 2, to_date('01.10.2009 13:12', 'dd.mm.yyyy hh24:mi'), to_date('01.10.2009 14:04', 'dd.mm.yyyy hh24:mi') from dual union all
      select 3, to_date('01.10.2009 13:35', 'dd.mm.yyyy hh24:mi'), to_date('01.10.2009 13:55', 'dd.mm.yyyy hh24:mi') from dual union all
      select 1, to_date('01.10.2009 14:35', 'dd.mm.yyyy hh24:mi'), to_date('01.10.2009 14:50', 'dd.mm.yyyy hh24:mi') from dual union all
      select 1, to_date('01.10.2009 14:45', 'dd.mm.yyyy hh24:mi'), to_date('01.10.2009 14:50', 'dd.mm.yyyy hh24:mi') from dual
    ;
    

    The query below unpivots these data in separate lines for rec_start and rec_end. We use the analytical SUM function to count each + 1 rec_start and each rec_end as -1 to get the number of concurrent users at any time. As soon as we have these data, we can use GROUP BY TRUNC (dt, 'HH')as Sven Hoek has suggested, to get the maximum by houir:

    WITH     cntr         AS
    (
         SELECT     1  AS cnt     FROM dual     UNION ALL
         SELECT     -1 AS cnt     FROM dual
    )
    ,     events     AS
    (
         SELECT     CASE     cntr.cnt
                   WHEN   1  THEN  t.rec_start
                   WHEN  -1  THEN     t.rec_end
              END     AS dt
         ,     cntr.cnt
         FROM          t
         CROSS JOIN     cntr
    )
    ,     concurrent_users     AS
    (
         SELECT     TRUNC (dt, 'HH')          AS hour
         ,     SUM (cnt) OVER (ORDER BY dt)     AS concurrent_users
         FROM     events
    )
    SELECT       hour
    ,       MAX (concurrent_users)     AS max_of_conc_users
    FROM       concurrent_users
    GROUP BY  hour
    ORDER BY  hour;
    

    Output:

    HOUR             MAX_OF_CONC_USERS
    ---------------- -----------------
    01.10.2009 12:00                 2
    01.10.2009 13:00                 3
    01.10.2009 14:00                 3
    
  • Need help with SQL SELECT

    Hello

    I have a table named WORK_CODES
    There only a single column CODE
    The CODE values are
    YES
    NO.
    A
    B
    C

    I get a connection variable: var1
    If: var1 is TRUE = > YES, I'll be back
    If: var1 is NOT TRUE = > I would alternate record in the WORK_CODES table.

    The tricky part is that it must be managed in a SQL query.
    Any help on this is appreciated.

    Thank you
    Pradeep


    The first problem I see is that SQL does not support the Boolean data type. Then you must consider changing the data type of your variable binding.

    Assuming that you change it to integer where 1 = 0 = false and true, you can do

    I guess I misunderstood. You can do it simply.

    select *
      from 
     where (:var = 'TRUE' and code = 'YES') or (:var = 'NOT TRUE' and code != 'YES')
    

    Published by: Karthick_Arp on January 14, 2010 23:30

  • Need help with SQL selection ID when the sequence does not match...

    I have the following dilemma:
    Database identifiers as follows:
    Incident #, case #, & sequence manufacturer
    example of
    Record 1
    Incident_Number = 123456
    Case_Number = 1
    Part_sequence = 1

    Worksheet 2
    Incident_Number = 123456
    Case_Number = 1
    Part_sequence = 2

    Sometimes the user will delete (say) 2 Record after creating a new Record 3
    The sequencing will therefore now as follows:

    Record 1
    Incident_Number = 123456
    Case_Number = 1
    Part_sequence = 1

    Worksheet 2
    Incident_Number = 123456
    Case_Number = 1
    Part_sequence = 3

    Now it is no longer a Part_Sequence 2

    Need a SQL to select all records where the sequence of the maximum part > than Incident_number County | » -'|| Case_number

    I tried the following:
    select a.incident_number||'-'||a.case_number||'-'||a.part_sequence
    from chsuser.a_compl_summary a
    where a.entry_date >= '01-may-2011'
    and max(a.part_sequence) > count(distinct a.incident_number||'-'||a.case_number)
    I end up getting an ORA-00934: Group feature is not allowed here (emphasis on the portion (a.part_sequence) Max.

    Advice/suggestions

    Thank you
    select  incident_number || '-' || case_number || '-' || part_sequence
      from  (
             select  incident_number,
                     case_number,
                     part_sequence,
                     max(part_sequence) over(partition by incident_number,case_number) max_seq,
                     count(*) over(partition by incident_number,case_number) cnt
               from  chsuser.a_compl_summary
               where entry_date >= DATE '2011-05-01'
            )
      where cnt != max_seq
    /
    

    SY.

  • With the help of inplace column number of the column name in the SQL Select statement

    Is it possible to execute instructions select sql with the number of columns in
    place names of columns?

    Run SQL
    select AddressId,Name,City from Address
    Is it possible
    select 1,2,5 from Address
    Thanks in advance

    You can extract the names of the columns for user_tab_columns
    with

    SELECT Column_name
    FROM user_tab_columns
    where table_name = 'MY_TABLE'
    and Column_id in (1,2,5)
    

    Use dynamic SQL and then the result to get the values.

    But as others already mentioned, this wil it be given incorrect if your table is changed.

  • SQL select statements

    Hey everybody,

    First of all, Yes, I searched through the 8.5 database schema guide.  As I went through the scheme, I've developed some ideas on how to collect the data you want.  However, if someone has already developed or found the SQL statements (which I'm sure that someone already has) it would help by reducing to the minimum of the buggs in my data collection program.

    All these statistics must be grouped by CSQ and selected for a certain time interval ( and ).  That is, levels of 1 hour.  I have no problem to get a list of results and then perform v.f. to achieve the desired final result.  Also, if I need to run several select statements for tables of essentially two join, please include two statements.  Finally, I saw the RtCSQsSummary table, but I need to collect data for the past, not at this time.

    1 total calls presented by the CSQ

    2. total number of calls answered by the CSQ

    3 total number of calls abandoned by the CSQ

    4. percentage of calls abandoned by CSQ (if it is not stored in the database, I think: /)

    5. average abandon time in seconds (if it is not stored in the DB, I think: sum () /)

    6. service level - % calls answered in 90 seonds by a set of skills (I have seen metServiceLevel in the ContactQueueDetail table; however, I need to find how to configure this threshold for application)

    7. average speed of response by CSQ

    8 average conversation by CSQ calls

    9. the aggregates connected full-time resources or agents CSQ

    10. resources/agents of CSQ ready time

    I realize that some of them should be easy to find (as I always am search in the guide of db schema), but I was reading how a new record is created for each step of the call so I could easily see how I could get inaccurate information without properly developed select statements.

    Any help will be greatly appreciated.

    Brendan

    Brendan,

    I read your message very well.

    You have the schema of database with tables and description. each table has its associated tables (connected with primary and foreign keys). I think you should start the tables to determine what you need.

    Cisco uses the stored procedure to prepare the reports. the stored procedure is 'sp_csq_interval' to create the report.

    Activity report of Queue Service contact"

    HTH

    Anas

    Please note all useful posts

Maybe you are looking for