Need help with the output of the query formatting

Hello

Here are the scripts to create the table and create test data:

create table result (acct number(10), acct_nm varchar2(100), stage varchar2(10), target_pc number(10,2), long_target_pc number(10,2))
/
Insert into RESULT
   (ACCT, ACCT_NM, STAGE, TARGET_PC, LONG_TARGET_PC)
Values
   (47042, 'Dora the explorer', 'AFTER', 33.6, 48)
/  
Insert into RESULT
   (ACCT, ACCT_NM, STAGE, TARGET_PC, LONG_TARGET_PC)
Values
   (47042, 'Dora the explorer', 'BEFORE', 33.6, 48)
/  
Insert into RESULT
   (ACCT, ACCT_NM, STAGE, TARGET_PC, LONG_TARGET_PC)
Values
   (41142, 'Bob the Builder', 'AFTER', 9.18, 20.4)
/  
Insert into RESULT
   (ACCT, ACCT_NM, STAGE, TARGET_PC, LONG_TARGET_PC)
Values
   (41142, 'Bob the Builder', 'BEFORE', 9.18, 20.4)
/  
Insert into RESULT
   (ACCT, ACCT_NM, STAGE, TARGET_PC, LONG_TARGET_PC)
Values
   (41086, 'Sofia the first', 'AFTER', 17.96, 51.3)
/  
Insert into RESULT
   (ACCT, ACCT_NM, STAGE, TARGET_PC, LONG_TARGET_PC)
Values
   (41086, 'Sofia the first', 'BEFORE', 2.98, 8.5)
/  
Insert into RESULT
   (ACCT, ACCT_NM, STAGE, TARGET_PC, LONG_TARGET_PC)
Values
   (41086, 'Sofia the first', 'BEFORE', 14.98, 42.8)
/  
COMMIT
/

I need output in the following format when I query this table:

Account         Account Name        Stage       Target PC       Long Target PC
41086           Sofia the first   
                                   BEFORE            2.98                  8.5
                                                    14.98                 42.8
                                   AFTER            17.96                 51.3
41142           Bob the Builder                                                     
                                   BEFORE            9.18                 20.4
                                   AFTER             9.18                 20.4
47042           Dora the explorer                                                     
                                   BEFORE           33.6                  48.0
                                   AFTER            33.6                  48.0
   
Total Accounts = 3


Here is what I tried but it does not gives me out I want (below referred to as the code):

spool c:\break_test.txt
column acct format 9999999999
column acct_nm format a50
column stage format a15
column target_pc format 999.99
column long_target_pc format 999.99
break on acct, acct_nm, stage
select * from result order by acct, stage desc


      41086 Sofia the first                                    BEFORE              2.98           8.50
      41086 Sofia the first                                    BEFORE             14.98          42.80
      41086 Sofia the first                                    AFTER              17.96          51.30
      41142 Bob the Builder                                    BEFORE              9.18          20.40
      41142 Bob the Builder                                    AFTER               9.18          20.40
      47042 Dora the explorer                                  BEFORE             33.60          48.00
      47042 Dora the explorer                                  AFTER              33.60          48.00

Please tell us how to get there.

Thanks in advance!

Go back and check the syntax of the PAUSE command.

SQL> column long_target_pc format 999.99
SQL> break on acct, acct_nm, stage
SP2-0158: unknown BREAK option "acct_nm,"

The syntax must be

sql> break on acct on acct_nm on stage

SQL formatting * more reports

Tags: Database

Similar Questions

  • need help with the query, thx

    Hello
    I need a little help with the query I have to write;
    the table has 4 columns:
    col1               col2         col3       col4
    emp_name     empl_id    salary      year
    
    content of data:
    
    col1               col2         col3       col4
    smith             12           1200      1999
    smith             12           1340      2000
    smith             12           1500      2001
    jones             13           1550      1999 
    jones             13           1600      2000
    aron              14           1200      2002
    what I am asking is the following result: salary according to the latest available year
    i.e.
    smith         12         1500        2001
    jones         13         1600        2000
    aron          14         1200        2002
    ID appreciate some guidance on how to achieve
    Thank you
    Rgds
    select *from
    (select col1, col2,col3, col4,row_number() over(partition by col1 order by col4 desc)  rn  from 
    ) where rn=1
    
  • Need help with the query to get the County

    Hello

    Oracle 10 g 2 10.2.0.3 - 64 bit

    I want back the number of accounts with two different types of funds (say A and B). Some accounts hold only one of the two funds, and some support both. I want to get the counts like this:

    • account held funds - has only
    • accounts holding funds-B only
    • accounts holding the Fund-A and B funds

    Here is what I started with but need assistance to meet the requirement above:

    select 
    count(distinct acct.bkoff_acct_no ) accounts_holding_fund_A
    from xe_account acct,
            xec_tal_investment_mandate iman,
            xec_tal_asset_allocation alloc,
            xe_benchmark bmark,
            xe_benchmark_usage bu,
            xe_object_description xod,
            xec_asset_class cls
    where iman.mandate_status_cd='A'
    and cls.asset_class_cd = alloc.asset_class_cd
    and iman.mandate_id = alloc.mandate_id
    and acct.account_id = iman.object_id
    and iman.object_type_cd = 'ACCT'
    and iman.mandate_id = xod.object_id
    and xod.field_nm='XEC_TAL_INVESTMENT_MANDATE.COMMENT_TXT'
    and xod.language_cd = 'E'
    and acct.acct_status_cd = 'O'
    and bu.object_type_cd(+) = 'TMAA'
    and bu.object_id(+) = alloc.asset_allocation_id
    and bmark.benchmark_id(+) = bu.benchmark_id
    and alloc.resp_txt like '%fund-A%'
    
    
    

    And suppose that the Fund-B has resp_txt like ' % of Fund-B»

    Please suggest.

    Concerning

    Hello

    Here is another way, it is easier to adapt to different jobs and different numbers of jobs:

    WITH got_distinct_jobs AS

    (

    SELECT DISTINCT deptno, job

    FROM scott.emp

    WHERE job IN ("ANALYST", "CLERKS") - or what

    )

    got_job_list AS

    (

    SELECT LISTAGG (job, ",") THE Group (ORDER BY work) AS job_list

    OF got_distinct_jobs

    GROUP BY deptno

    )

    SELECT job_list

    COUNT (*) AS num_departments

    OF got_job_list

    GROUP BY job_list

    ;

    This shows all the combinations of the jobs listed in the WHERE clause of got_distinct_jobs.  You don't need to change anything else in the query.  There may be any number of jobs.

    Output:

    JOB_LIST NUM_DEPARTMENTS

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

    CLERK                                        2

    ANALYST, CLERK 1

  • Need help with the query (transpose)

    Hello experts, please help here - 11 g Oracle, attribute APA APB are fixed values and can be hard coded in query

    Need to transpose these data. Max(decode.. perd les données en sortie à cause de la condition de Max.)

    Entry:

    Name | Attribute | Value

    A1 APP 10

    A1 PDB 11

    A1 APA 20

    A1 PDB 21

    A2 BPA 13

    A2 BPB 14

    Expected results:

    Name AttVal1 AttVal2

    A1 10 11

    13 14 A2

    20 21 A1

    Hello

    Here's one way:

    WITH relevant_columns AS

    (

    SELECT name

    value

    CASE

    WHEN the attribute ("APA", "BPA") THEN 1

    WHEN the attribute ("PDB", "BPB") THEN 2

    END AS c_num

    ROW_NUMBER () (PARTITION BY NAME, attirbute

    Value of ORDER BY

    ) AS r_num

    FROM table_x

    )

    SELECT name, attval1, attval2

    OF relevant_columns

    PIVOT (MAX (value)

    FOR c_num IN (1 AS attval1

    2 UNDER attval2

    )

    )

    ORDER BY r_num, name

    ;

    If you would care to post CREATE TABLE and INSERT statements for your sample data, and then I could test this.

    Why do you want to

    NAME ATTVAL1 ATTVAL2

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

    A1 10 11

    20 21 A1

    in the results, rather than

    NAME ATTVAL1 ATTVAL2

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

    10 21 A1

    20 11-A1

    ?  You would be satisfied to one or the other?

    Depending on your answer, you may need to modify the analytical ORDER BY clause in the ROW_NUMBER function.

  • Need help with the query. Help, please

    Hey everyone, need your help.  Thank you in advance.  In my view, there is function Pivot.  Just do not know how to use this function.  I have the query that works.  The result is:

    11-111-1111 Vlad 16505 01/04/2013 5 August 13 dental plan pre-tax amount 29,65

    11-111-1111 Vlad 16505 01/04/2013 dental pre-tax 5 August 13 Plan level EE + SP

    11-111-1111 16505 Vlad 01/04/2013 5 August 13 pre-tax Option TOP dental plan

    11-111-1111 Vlad 16505 01/04/2013 5 August 13 pre-tax dental care plan pay the value

    11-111-1111 16505 Vlad 01/04/2013 dental pre-tax 5 August 13 Plan period Type

    11-111-1111 Vlad 16505 01/04/2013 amount pre-tax medical Plan of 5 August 13 149

    11-111-1111 Vlad 16505 01/04/2013 5 August 13 pre-tax Medical Plan level EE + SP

    11-111-1111 Vlad 16505 01/04/2013 5 August 13 pre-tax Plan medical Option MED

    11-111-1111 Vlad 16505 01/04/2013 5 August 13 plan pre-tax pay value

    11-111-1111 16505 Vlad 01/04/2013 5 August 13 pre-tax Medical Plan period Type

    11-111-1111 Vlad 16505 01/04/2013 5 August 13 pre-tax Plan PPO medical Plan

    11-111-1111 Vlad 16505 01/04/2013 5 August 13 Vision Plan amount 5.94 pre-tax

    But I need the result to be

    Amount of SSN ID name item level Option PayValue period Type

    11-111-1111 Vlad 16505 01/04/2013 null null high of 5 August 13 pre-tax Dental Plan 29,65 EE + SP

    11-111-1111 Vlad 16505 01/04/2013 null null MED 5 August 13 149 medical plan pre-tax EE + SP

    11-111-1111 Vlad 16505 01/04/2013 Vision Plan before taxes of 5 August 13

    Select distinct
    ' 11-111-1111 "as ssn,
    WOMEN'S WEAR. Employee_number,
    "Vlad" as EMPLOYEE_FULL_NAME,
    TO_CHAR (papf.start_date, "MM/DD/YYYY") as Date_Of_Hire
    a.effective_start_date,
    PETF.element_name,
    pivf. Name,
    peevf.screen_entry_value

    Of
    PER_all_PEOPLE_F women's wear
    per_assignments_f A
    pay_element_types_f petf
    pay_element_links_f pelf
    PAY_ELEMENT_ENTRIES_F penf
    PAY_ELEMENT_ENTRY_VALUES_F peevf
    pay_input_values_f pivf
    WHERE
    PETF.element_name ('Dental Plan before taxes', 'Medical Plan before taxes', "Vision Plan before taxes")
    and petf. ELEMENT_TYPE_ID = pelf. ELEMENT_TYPE_ID
    and (trunc (sysdate) BETWEEN pelf. EFFECTIVE_START_DATE AND pelf. EFFECTIVE_END_DATE)
    and (pelf. ELEMENT_LINK_ID = penf. ELEMENT_LINK_ID and a.assignment_id = penf. ASSIGNMENT_ID)
    and (trunc (sysdate) BETWEEN penf. EFFECTIVE_START_DATE AND penf. EFFECTIVE_END_DATE)
    and penf. ELEMENT_ENTRY_ID = peevf. ELEMENT_ENTRY_ID
    and peevf. INPUT_VALUE_ID = pivf. INPUT_VALUE_ID
    AND papf.employee_number IS NOT NULL
    AND A.assignment_type = 'E '.
    AND A.person_id = papf.person_id
    and papf.effective_end_date > sysdate
    and a.effective_end_date > sysdate
    and (trunc (sysdate) BETWEEN women's wear. EFFECTIVE_START_DATE AND women's wear. EFFECTIVE_END_DATE)
    and a.effective_start_date = (select MAX (effective_start_date) from PER_ASSIGNMENTS_f where assignment_id = a.assignment_id)
    and a.assignment_id = 42643
    and a.assignment_status_type_id = '1'
    order of petf.element_name;

    Change with your query

    SELECT * FROM (select distinct)

    ' 11-111-1111 "as ssn,

    WOMEN'S WEAR. Employee_number,

    "Vlad" as employee_full_name,

    TO_CHAR (papf.start_date, "MM/DD/YYYY") as date_of_hire

    a.effective_start_date,

    PETF.element_name,

    pivf. Name,

    peevf.screen_entry_value

    Of

    PER_all_PEOPLE_F women's wear

    per_assignments_f A

    pay_element_types_f petf

    pay_element_links_f pelf

    PAY_ELEMENT_ENTRIES_F penf

    PAY_ELEMENT_ENTRY_VALUES_F peevf

    pay_input_values_f pivf

    WHERE

    PETF.element_name ('Dental Plan before taxes', 'Medical Plan before taxes', "Vision Plan before taxes")

    and petf. ELEMENT_TYPE_ID = pelf. ELEMENT_TYPE_ID

    and (trunc (sysdate) BETWEEN pelf. EFFECTIVE_START_DATE AND pelf. EFFECTIVE_END_DATE)

    and (pelf. ELEMENT_LINK_ID = penf. ELEMENT_LINK_ID and a.assignment_id = penf. ASSIGNMENT_ID)

    and (trunc (sysdate) BETWEEN penf. EFFECTIVE_START_DATE AND penf. EFFECTIVE_END_DATE)

    and penf. ELEMENT_ENTRY_ID = peevf. ELEMENT_ENTRY_ID

    and peevf. INPUT_VALUE_ID = pivf. INPUT_VALUE_ID

    AND papf.employee_number IS NOT NULL

    AND A.assignment_type = 'E '.

    AND A.person_id = papf.person_id

    and papf.effective_end_date > sysdate

    and a.effective_end_date > sysdate

    and (trunc (sysdate) BETWEEN women's wear. EFFECTIVE_START_DATE AND women's wear. EFFECTIVE_END_DATE)

    and a.effective_start_date = (select MAX (effective_start_date) from PER_ASSIGNMENTS_f where assignment_id = a.assignment_id)

    and a.assignment_id = 42643

    and a.assignment_status_type_id = '1')

    PIVOT (MAX (screen_entry_value) FOR (name) TO ("Amount" AS 'Amount', 'level' AS 'level', 'Option High' AS 'High Option', 'Pay the value' AS 'Value to pay', 'Period of Type' AS 'Type period'))

    order by element_name;

    (GOLD)

    SELECT ssn,

    Employee_number,

    employee_full_name,

    date_of_hire,

    effective_start_date,

    element_name,

    Max (decode (Name, 'Amount', screen_entry_value)) 'amount. "

    Max (decode (Name, 'Level', screen_entry_value)) 'level ',.

    MAX (DECODE (name, "High Option", screen_entry_value)) "High Option",

    MAX (DECODE (name, 'Value of pay', screen_entry_value)) 'value of pay. "

    MAX (DECODE (name, 'Period Type', screen_entry_value)) 'period of Type '.

    FROM (select distinct)

    ' 11-111-1111 "as ssn,

    WOMEN'S WEAR. Employee_number,

    "Vlad" as employee_full_name,

    TO_CHAR (papf.start_date, "MM/DD/YYYY") as date_of_hire

    a.effective_start_date,

    PETF.element_name,

    pivf. Name,

    peevf.screen_entry_value

    Of

    PER_all_PEOPLE_F women's wear

    per_assignments_f A

    pay_element_types_f petf

    pay_element_links_f pelf

    PAY_ELEMENT_ENTRIES_F penf

    PAY_ELEMENT_ENTRY_VALUES_F peevf

    pay_input_values_f pivf

    WHERE

    PETF.element_name ('Dental Plan before taxes', 'Medical Plan before taxes', "Vision Plan before taxes")

    and petf. ELEMENT_TYPE_ID = pelf. ELEMENT_TYPE_ID

    and (trunc (sysdate) BETWEEN pelf. EFFECTIVE_START_DATE AND pelf. EFFECTIVE_END_DATE)

    and (pelf. ELEMENT_LINK_ID = penf. ELEMENT_LINK_ID and a.assignment_id = penf. ASSIGNMENT_ID)

    and (trunc (sysdate) BETWEEN penf. EFFECTIVE_START_DATE AND penf. EFFECTIVE_END_DATE)

    and penf. ELEMENT_ENTRY_ID = peevf. ELEMENT_ENTRY_ID

    and peevf. INPUT_VALUE_ID = pivf. INPUT_VALUE_ID

    AND papf.employee_number IS NOT NULL

    AND A.assignment_type = 'E '.

    AND A.person_id = papf.person_id

    and papf.effective_end_date > sysdate

    and a.effective_end_date > sysdate

    and (trunc (sysdate) BETWEEN women's wear. EFFECTIVE_START_DATE AND women's wear. EFFECTIVE_END_DATE)

    and a.effective_start_date = (select MAX (effective_start_date) from PER_ASSIGNMENTS_f where assignment_id = a.assignment_id)

    and a.assignment_id = 42643

    and a.assignment_status_type_id = '1')

    GROUP BY ssn, employee_number, employee_full_name, date_of_hire, effective_start_date, NOM_ELEMENT

    order by element_name;

  • Need help with the query logic

    I have 2 tables.

    Table Tb1:
    THE PLAN_ID PARENT_PLAN_ID ARGUMENT
    Value null P1
    P1 P2
    P3 P2
    P4 P1

    Table tb2:
    THE PLAN_ID ACTIVITY_ID PICKING ARGUMENT
    P2 A1 5000
    P2 A2 5000
    P2 A3 5000
    P3 A1 10000
    P3 A2 10000
    P4 A1 4000


    I need to find the sum of the value of reduction of the workforce for each PLAN_ID which is parent root. In the case above, this is the argument PLAN_ID P1 (WHERE PARENT_PLAN_ID IS NULL). Please note that the value of the downsizing is repeated in the tb2 table. For example, the PLAN_ID P2 argument, the value of the downsizing is 5000 and not 5000 + 5000 + 5000.

    The result of the output for the above data must be
    THE ARGUMENT PLAN_ID DRAWDOWN
    P1 19000

    Published by: user10566312 on October 30, 2012 12:30
    with t as
    (   select t1.plan_id,t1.parent_plan_id,max(t2.DRAWDOWN) DRAWDOWN
        from tb1 t1,tb2 t2
        where t1.plan_id = t2.plan_id(+)
        group by  t1.plan_id,t1.parent_plan_id
    )
    select plan_id,sum(drawdown) drawdown
    from(
          select  connect_by_root plan_id as plan_id,
                  nvl(DRAWDOWN,0) DRAWDOWN
          from t
          start with parent_plan_id is null
          connect by parent_plan_id  = prior plan_id
        )
    group by plan_id  ; 
    
    PLAN_ID DRAWDOWN
    ------- --------
    P1         19000 
    

    Published by: JAC on October 30, 2012 13:23

  • Need help with the query using the aggregation

    If I have a table, defined as follows:

    CREATE TABLE range_test
    (
    range_id NUMBER (20) NOT NULL,
    rank of char (1) NOT NULL,
    lower_bound_of_range NUMBER (5.2) NOT NULL,
    upper_bound_of_range NUMBER (5.2) NOT NULL,
    received_date_time_stamp SYSTIMESTAMP NOT NULL DEFAULT TIMESTAMP
    );

    And I wanted to query the table to find the range associated with the last line inserted for each 'class' (for example 'A', 'B', 'C', etc.), how would I go about this?

    I want something like the following, but I know that it will not work right:

    SELECT
    grade,
    lower_bounding_of_range,
    upper_bounding_of_range,
    Max (received_date_time_stamp)
    Of
    range_test GROUP BY received_date_time_stamp;

    Thanks for your help... I am frustrated with this one and I think that it should be possible without having to use the PL/SQL (i.e. the functions of SQL aggregation or subqueries should work).

    Perhaps something along the lines of...

    SQL> ed
    Wrote file afiedt.buf
    
      1  select deptno, empno, ename, hiredate
      2  from emp
      3* order by deptno, empno
    SQL> /
    
        DEPTNO      EMPNO ENAME      HIREDATE
    ---------- ---------- ---------- --------------------
            10       7782 CLARK      09-JUN-1981 00:00:00
            10       7839 KING       17-NOV-1981 00:00:00
            10       7934 MILLER     23-JAN-1982 00:00:00
            20       7369 SMITH      17-DEC-1980 00:00:00
            20       7566 JONES      02-APR-1981 00:00:00
            20       7788 SCOTT      19-APR-1987 00:00:00
            20       7876 ADAMS      23-MAY-1987 00:00:00
            20       7902 FORD       03-DEC-1981 00:00:00
            30       7499 ALLEN      20-FEB-1981 00:00:00
            30       7521 WARD       22-FEB-1981 00:00:00
            30       7654 MARTIN     28-SEP-1981 00:00:00
            30       7698 BLAKE      01-MAY-1981 00:00:00
            30       7844 TURNER     08-SEP-1981 00:00:00
            30       7900 JAMES      03-DEC-1981 00:00:00
    
    14 rows selected.
    
    SQL> ed
    Wrote file afiedt.buf
    
      1  select deptno, empno, ename, hiredate
      2  from (
      3        select deptno, empno, ename, hiredate
      4              ,row_number() over (partition by deptno order by hiredate desc) as rn
      5        from emp
      6       )
      7  where rn = 1
      8* order by deptno, empno
    SQL> /
    
        DEPTNO      EMPNO ENAME      HIREDATE
    ---------- ---------- ---------- --------------------
            10       7934 MILLER     23-JAN-1982 00:00:00
            20       7876 ADAMS      23-MAY-1987 00:00:00
            30       7900 JAMES      03-DEC-1981 00:00:00
    
    SQL>
    
  • need help with the query: (Frank)

    Hi Frank,.

    I have the oracle 8 database.
    I have the following table with the data structure:

    TABLE P (PID, PNAME, COLOR)
    PRIMARY KEY: PID
    PID     Pname    Color
    p1...........          Red
    P2.................    green
    p3...............       blue
    p4 ..................   red
    CAT TABLE (SID, PID, COST)
    KEY: SID MAIN + PID
    KEY REFERENCE: SID REFERENCE S.SID
    PID P.PID REFERENCES
    Sid        Pid       COst....
    S1        P1
    S2        P2
    S3        P3
    S1      P4
    S2       p1
    S3        p1
    now my question is:
    I want to find the SIDS of suppliers that provide a red and a green part

    for this I used the following query, but it gives the result worng...

    can help me please in this way to get this...
    select sid from cat
    where pid in (select pid from p where color= 'red'
              union
              select pid from p where color = 'gren') 
    group by sid having count(pid) >= 2

    Hello

    Jojo wrote:
    Hi Frank,.

    It would be nice if someone with a different name helped you? Do not restrict yourself by addressing someone in particular in your subject line or the first message.

    I have the oracle 8 database.
    I have the following table with the data structure:

    TABLE P (PID, PNAME, COLOR)
    PRIMARY KEY: PID

    PID     Pname    Color
    p1...........          Red
    P2.................    green
    p3...............       blue
    p4 ..................   red
    

    CAT TABLE (SID, PID, COST)
    KEY: SID MAIN + PID
    KEY REFERENCE: SID REFERENCE S.SID
    PID P.PID REFERENCES

    Sid        Pid       COst....
    S1        P1
    S2        P2
    S3        P3
    S1      P4
    S2       p1
    S3        p1
    

    now my question is:
    I want to find the SIDS of suppliers that provide a red and a green part

    for this I used the following query, but it gives the result worng...

    can help me please in this way to get this...

    select sid from cat
    where pid in (select pid from p where color= 'red'
              union
              select pid from p where color = 'gren')
    group by sid having count(pid) >= 2
    

    You don't like what is the number of lines with a pid; If you had 20 rows all said 'p1', that would be good enough. The number of distinct colors of the whole ('red', 'green') is what is important.
    Avoid the UNION when there is a simple alternative. The UNION tends to be slow.

    You can use a join instead, like this:

    SELECT       c.sid
    FROM       cat     c
    ,            p
    WHERE       p.pid          = c.pid
    AND       p.color       IN ('red', 'green')
    GROUP BY  c.sid
    HAVING       COUNT (DISTINCT p.color)     = 2
    ;
    

    If you would care to post CREATE TABLE and INSERT statements for the sample data and the results that you want from this data, then I could test this.

    Published by: Frank Kulash, January 10, 2011 15:25

  • Need help with the query string manipulation

    Hello

    With the help of 10.1.0.4.2

    Given a table called PREFIX_CODES that contains a column called PREFIX_CODE
    with the following data:

    PREFIX_CODE - VARCHAR2 (20)
    -------------------
    AAA
    BENAMER
    CARTER

    and another table called SUBSCRIBERS with a column called SUBSCRIBER_ID
    with the following data:

    SUBSCRIBER_ID - VARCHAR2 (30)
    ---------------------
    BBBB-123456
    AAA-444444
    DD-2222222
    EEEE-888888

    Is there a query that will pull all the SUBSCRIBER_ID that begin with
    each of the PREFIX_CODES? The following query is not valid, but it
    This will give you an idea of what I'm trying to do:

    SELECT SUBSCRIBER_ID
    SUBSCRIBERS
    WHERE AS SUBSCRIBER_ID (SELECT PREFIX_CODE |) » %'
    OF PREFIX_CODES)

    Using the data from above, I would like that the query to return:

    BBBB-123456
    AAA-444444

    Thanks for your help!

    Hello

    Welcome to the forum!

    You were on the right track. To find if a given subscriber corresponds to any prefix_code, you can do an EXISTS subquery:

    SELECT     subscriber_id
    FROM     subsribers     s
    WHERE     EXISTS ( SELECT  NULL
                      FROM      prefix_codes
               WHERE      s.subscriber_id     LIKE prefix_code || '%'
                )
    ;
    

    This will tell you if at least a prefix code. It won't tell you exactly how many, or what they were.
    Your message, I'm guessing that there may be more than one, and you can deduct the subscriber_id itself, then the above query should work for you.

  • Need help with the Word format Req'd for RoboHelp

    I was asked to help a company with technical writing for an online application. All their online help is in RoboHelp. I need to create about 450 pages of extra help to complete the help system. The company is owner of RoboHelp, I did not. I understand that Word documents can be imported in RoboHelp. Where can I find the format that word documents should be so that they can be imported successfully into RoboHelp?

    Any help would be greatly appreciated.

    Welcome to the forum.

    Importing in RoboHelp Word documents can give rise to a number of problems, as you will see if you take a look at the section about this on my site. The first thing that would answer this question is to know if the company is using HR to Word or HTML HR.

    If they use HR for Word, all you need to do, is make sure that the styles you use in your documents are the standard ones they use to existing aid. Only they can tell you what they want and it is for them to sit down with you to suit the required format. Note that each topic must begin with the heading 1 style. You should also know if they want a document with 450 topics (not recommended) or 450 documents, something between the two.

    If they use HTML HR, then I suggest you create a few sample topics and make import these topics. They need to become familiar with the process and I suggest that they too see the topics on my site.

    In particular, if there are many tables, you should test they import properly.

    The company themselves will have to work closely with you on that in the early stages with several test runs. They must save their project before you import it to save a lot of grief, if things don't quite work.

    I'm sure others can add others.

  • Need help with the query and output

    I have a table that contains a list of property and each an asset contains a category field, each an asset can have several categories assigned, then the category column is filled in a list (for example, 14, 16, 17, 19).

    The values are based on a table of categories using the primary key as a reference number (for example 14 = keyboards, 16 = Trackballs, etc..)

    I tried to understand how the power of categories so that when the category is displayed, the list will appear under the name of the category as opposed to the non referenced.

    example:
    < name cfquery = "qIndex" datasource = "#appDSN #" >
    SELECT Asset.Reference, Asset.AssetName, Asset.Category
    Assets
    WHERE category LIKE ' %#URL. Category #% '
    < / cfquery >

    < cfoutput query = "qIndex" >
    #Asset.Reference # < br / >
    #Asset.AssetName # < br / >
    #Asset.Category #.
    < / cfoutput >

    Exhibition:
    AD_987738
    Keyboard XYZ
    11, 14, 17, 18

    Table for categories are:
    CatID = primary key
    Category = category name
    CatImage = header Image

    Thanks for any help.

    Finally figured this out. Had to insert an intermediate query within the output to filter each record, otherwise he was out the results of the first record only and repeat.


    SELECT *.
    Assets
    WHERE category LIKE ' %#URL. Category #% '


    SELECT the CATEGORY, AssetID
    Assets
    WHERE assetID = #qIndex.AssetID #.


    Category category WHERE CatID IN (#catids #)


    Category: #qCat.Category #,

    #qIndex.Asset #.

    #qIndex.Reference #.

    Thanks again for the help.
    Paul

  • NEED HELP WITH THE QUERY, NEED MORE RECENT FILE ONLY

    Hi all

    That is,

    I have an assignment I need to find agents that allow players to break the rules.

    So far, I have 41 results, in which there are 4 principles and 24 footballers and football player even beat more than one rule or the rule more than once.

    What I need now is to make arrangements so that every footballer appears once n matter how many times they have broken the rules.


    I have

    SELECT
    t.transfer_time | ' ' || a.first_name | ' ' || a.last_name | ' ' || f.first_name | ' ' || f.last_name | ' ' || f.footballer_id | ' ' || t.transfer_id
    Of
    agents a, t transfers, footballers f, footballers_fees fo
    WHERE
    a.agent_id = t.broker_id
    AND
    t.footballer_id = f.footballer_id
    AND
    f.footballer_id = fo.footballer_id
    AND
    (RULE 1 BROKEN AND RULE 2 BROKEN
    OR
    RULE 1 BROKEN AND ARTICLE 2 DOES NOT DECOMPOSE
    OR
    RULE 1 DOES NOT DECOMPOSE AND RULE 2 BROKEN)


    GROUP BY
    t.transfer_time | ' ' || a.first_name | ' ' || a.last_name | ' ' || f.first_name | ' ' || f.last_name | ' ' || f.footballer_id | ' ' || t.transfer_id
    ORDER BY
    t.transfer_time | ' ' || a.first_name | ' ' || a.last_name | ' ' || f.first_name | ' ' || f.last_name | ' ' || f.footballer_id | ' ' || t.transfer_id
    ;



    (I did not type the SQL code to rules 1 and 2 but I know it works)

    Now, I need not to show that every footballer once they broke rule and more than once or not.

    I was looking at the screen nearly enough hours 10 and any help or ideas would be greatly appreciated

    Thank you all :)

    Hello

    Welcome to the forum!

    Whenever you have a problem, please post a small example of data (CREATE TABLE and INSERT statements) so that people who want to help you can recreate the problem and test their ideas. You don't have to display a large amount of data. In this case, it seems that 2 to 10 lines for each table could give a good picture of the problem.
    After the results that you want samples fropm, and explain how you get those resulting from these data.
    Always tell what version of Oracle you are using.

    The ideal outcome would be just what you '; Re I get now, but with some deleted rows and only 1 line by left footballer? If so, do a subquery on the original query, and then add somehting like

    , ROW_NUMBER () OVER (PARTITION BY f.footballer_id ORDER BY NULL)  AS r_num
    

    in the SELECT clause.
    then, in the main query, display only lines

    WHERE   r_num  = 1
    

    ROW_NUMBER requires an ORDER byclause of analytics. If you ORDER BY a constant (e.g. NULL) then what line gets number 1 will be arbitrary. If you care who lines for a given player is numbered 1 (and therefore included in the final output), then adjust the analytical ORDER BY clause. (You the title mentions "most recent record only", so if the dt column indicates whether a line is "newer" than another, you can "ORDER BY dt DESC".)

    I know this response is vague in places. Without a concrete example (CREATE TABLE and instructions INSERT for examples of data and outcomes from these data), that's the best I can do.

  • Need help with the query using the AVG function

    First post here.
    I am a student taking a SQL class and I can't find a query.
    I think I'm close to get it, but I can not quite all the way there.

    Three tables are involved in this problem. Here is a list of the tables and the areas concerned:
    orders table:
      order#
      shipstate
    
    orderitems table:
      order#
      isbn
      quantity         (How many copies of book purchased on that order)
    
    books table:
      isbn
      retail    (retail price of book)
    Problem:
    I want to get an average of "total amount" by shipstate.

    For example, in these tables, there are 8 records of the State of Florida.
    However, there are only 5 unique order # for this State.
    The amount of detail * quantity for these 8 disks (or 5 orders) is $345,10
    Now to get my average $345,10 should be divided by 5. (number of unique commands)
    In the following query it divides this $345,10 8. (number of records)

    How to make this request to divide by the number of unique order # rather than the number of records?
    SELECT shipstate, AVG(quantity * retail)
    FROM orders JOIN orderitems USING (order#)
    JOIN books USING (isbn)
    GROUP BY shipstate
    HAVING SUM(quantity * retail) =ANY
                                  (SELECT SUM(quantity * retail)
                                    FROM books JOIN orderitems USING (isbn)
                                    JOIN orders USING (order#)
                                    GROUP BY shipstate) 
    According to me, once I get this part down, I can understand the rest of the problem.
    The end result, I need, is to find all the individual commands that have a "total amount due" that is greater than the 'average amount due' for this state of clients.

    Any help, suggestions or comments welcome.
    Matt

    Your average take into account the shipstate (8 disks), you can do that for the expected results.
    With some examples of input data it would be easier, but here a try:

    SELECT shipstate, sum(quantity * retail)/count(distinct order#)
    FROM orders JOIN orderitems USING (order#)
    JOIN books USING (isbn)
    GROUP BY shipstate;
    

    Nicolas.

    delete the alias
    Edited by: N. Gasparotto on October 3, 2008 19:28

  • Need help with the query of the Recordset

    I need some major help please. Getting really frustrated here. My search page, if I do not fill in all fields and press SUBMIT, all records in the Recordset are displayed. Why? I have a default value ".". There should be no match. I don't understand. Can someone explain it to me?

    Help me obi - wan!

    I've recoded the entire page and now I want to. What I found myself doing this the $_GET at the beginning of the page and then for my request, I changed it "entered value". I think I can be on the right track.

  • Hello need help with the opacity mask.

    Hello need help with the opacity mask. I hope someone out there can help

    I inherited a logo that appears to use a Logo of OM has a shape with a grad. This grad at first sight is not used in the Grad scheme and there is not editable.  Looking at the transparency palette I find an OM (pic1) output option. If I choose what the grad on separates it from the page of the form, that is from there I can change/remove as required (Note2).

    However, sometimes (he did no change), I'll be back to the same original form and output option is grayed out and is no longer available. Or I go to the similar shape that has the same treatment and I can't go out OM (pic3)

    The only difference is the thumbnail in the transparency palette, which is strong in pic1 and rated on pic3. What Miss me?    I'm not clear what the advantage is simply OM using the Grad palette to apply a grad in my form, but until I can get rid of OM who is there, I can't comfortably apply to the grad I want.

    The white gradient LHS I have no problem with. I choose fortunately only and each time get the possibility of release of OM.

    Screen Shot 2015-08-06 at 12.26.48.pngScreen Shot 2015-08-06 at 12.00.10.pngScreen Shot 2015-08-06 at 12.01.16.png

    The other thing weird. When I select the white gradient. Sometimes, the exit option is in the palette without going through the drop-down list (Fig 4).

    Other times seems not that OM has already been applied, because the palette gives me the ability to mask rather than liberation (5 photos). Until I go to the drop down and then I find Release is an option after all.

    What is the difference here?   Not much of a problem, because either way I can release OM to be able to change the grad.

    The file is passed through several hands and play anywhere to try to resolve issues, and many stops and save slot, so something along the line was of course done a logo and not the other because of the difference, but I can't for the life of me see what that.

    Screen Shot 2015-08-06 at 12.44.21.pngScreen Shot 2015-08-06 at 12.44.36.png

    I hope someone can help. Very appreciated


    See you soon

    Dave

    Dave,

    I've (mis) understanding the issues, you can account for the box to the right in the main palette transparency (called thumbnail) here.

    Illustrator help | Transparency and blending modes

    represents the masking objects.

    Some of your screenshots show no object mask, so it only is not really a mask even if do the opacity mask has been clicked and there seems to be one in the layers palette, wherever you look.

    I think that it is perhaps the issue.

  • Need help with the installation of an adapter of Palit GeForce 9500GT Super chart - 512 MB in a M2N68 (narrated

    Need help with the installation of an adapter of graphics Super Palit GeForce 9500GT - 512 MB - DDR2 SDRAM in a M2N68 motherboard (narra6). Should I disable the onboard graphics in the bios? When the card is installed, no VGA work outs and the PC does not start. Checked and recontroler implementation of the card in the PCI slot. PC is a desktop HP G5200uk PC. Windows 7 operating system.

    Hello

    The link below is a guige to install a video card in your Pc.  In particular, it seems that you will have to perhaps specify the location of the new card in the bios and save this change before you install the new card - see step 4 in the guide on the link below.  If your new card fits into the PCI Express x 16 slot, you will need to define PCI Express in the bios and save the changes.

    http://support.HP.com/us-en/document/c01700855

    Kind regards

    DP - K

Maybe you are looking for