Query help - group by

Hi all,
I need to get the sum(sal) and sum(comm) using select query..
I am using group by..but unable to get the result..
For example..if the table is
eno     ename     job     sal      comm     deptno
1234     john     manager     2000 1     10
1235     andrew     salesman     1000     2     20
1236     steven     manager     2000 3     20
1237     robert     clerk      600     4     10
1238     laura     manager     2000      5     20
1239     dan     salesman     500     6     30
1240     james     clerk     500     7     10
I need to display all the columns by select query and the result should be as follows:
eno     ename     job     sal     comm     deptno     sum(sal)     sum(comm)
1234     john     manager     2000     1     10     6000     9
1235     andrew     salesman     1000     2     20     1500      8
1236     steven     manager     2000     3     20     6000      9
1237     robert     clerk     600     4     10     1100     11
1238     laura      manager     2000     5     20     6000      9
1239     dan      salesman     500     6     30     1500      8
1240     james      clerk     500     7     10     1100     11
I appreciate your help...thanks !

Use anaytic SUM:
SQL> select  empno,
  2          ename,
  3          job,
  4          sal,
  5          comm,
  6          deptno,
  7          sum(sal) over(partition by deptno) sum_sal,
  8          sum(comm) over(partition by deptno) sum_comm
  9    from  emp
10  /
     EMPNO ENAME      JOB              SAL       COMM     DEPTNO    SUM_SAL   SUM_COMM
      7782 CLARK      MANAGER         2450                    10       8750
      7839 KING       PRESIDENT       5000                    10       8750
      7934 MILLER     CLERK           1300                    10       8750
      7566 JONES      MANAGER         2975                    20      10875
      7902 FORD       ANALYST         3000                    20      10875
      7876 ADAMS      CLERK           1100                    20      10875
      7369 SMITH      CLERK            800                    20      10875
      7788 SCOTT      ANALYST         3000                    20      10875
      7521 WARD       SALESMAN        1250        500         30       9400       2200
      7844 TURNER     SALESMAN        1500          0         30       9400       2200
      7499 ALLEN      SALESMAN        1600        300         30       9400       2200
     EMPNO ENAME      JOB              SAL       COMM     DEPTNO    SUM_SAL   SUM_COMM
      7900 JAMES      CLERK            950                    30       9400       2200
      7698 BLAKE      MANAGER         2850                    30       9400       2200
      7654 MARTIN     SALESMAN        1250       1400         30       9400       2200
14 rows selected.
SQL> SY.

Similar Messages

  • Query help - Group by range of program set

    Need help in developing query with the following set of data.
    Program
    req_id
    parent_id
    runtime
    A
    1
    -1
    30
    A1
    2
    1
    20
    A2
    3
    -1
    1
    A3
    4
    3
    5
    A4
    5
    -1
    7
    A5
    6
    -1
    4
    A6
    7
    -1
    3
    A1
    8
    1
    10
    A2
    9
    -1
    1
    A3
    10
    9
    2
    A4
    11
    -1
    3
    A5
    12
    -1
    2
    A6
    13
    -1
    2
    The results I am looking for is in the following format.
    Set
    G1
    G1_time
    G2
    G2_time
    G3
    G3_time
    Set1
    G1
    6
    G2
    11
    G3
    3
    Set2
    G1
    3
    G2
    5
    G3
    2
    Can you please tell if this can be achieved using sql in Oracle 11g?
    Thanks very much.

    Hi,
    Depending on your requirements:
    WITH   got_grp AS
        SELECT  program
        ,       LAST_VALUE ( CASE
                                 WHEN  program = 'A1'
                                 THEN  req_id
                             END
                             IGNORE NULLS
                           ) OVER ( ORDER BY  req_id ) AS grp
        ,       req_id
        ,       runtime
        FROM    a
    ,   got_c_num    AS
        SELECT  DENSE_RANK () OVER (ORDER BY grp) AS grp_num
        ,       runtime
        ,       CEIL ( ROW_NUMBER () OVER ( PARTITION BY  grp
                                            ORDER BY      req_id
                     / 2
                     )     AS c_num
        FROM    got_grp
        WHERE   program  NOT IN ('A', 'A1')
    SELECT     'SET' || grp_num    AS "SET"
    ,          'G1'                AS g1
    ,          g1_time
    ,          'G2'                AS g2
    ,          g2_time
    ,          'G3'                AS g3
    ,          g3_time
    FROM       got_c_num
    PIVOT     (    SUM (runtime)
              FOR c_num  IN ( 1 AS g1_time
                            , 2 AS g2_time
                            , 3 AS g3_time
    ORDER BY  grp_num
    Output:
    SET        G1    G1_TIME G2    G2_TIME G3    G3_TIME
    SET1       G1          6 G2         11 G3          3
    SET2       G1          3 G2          5 G3          2

  • How I check in group by query the group change

    How I check in group by query the group change
    Hi master
    Sir I have master detail table
    This is my query
    select rownum,chartofacc.accid,title,nvl(drbal,0),nvl(crbal,0),
    (select case when nvl(sum(debit),0)-nvl(sum(credit),0)>0 then
    nvl(sum(debit),0)-nvl(sum(credit),0)
    else
    0
    end mfadrttt
    from voudetail where voudetail.accid=chartofacc.accid) as mfadr,
    (select case when nvl(sum(credit),0)-nvl(sum(debit),0)>0 then
    nvl(sum(credit),0)-nvl(sum(debit),0)
    else
    0
    end mfacrttt
    from voudetail where voudetail.accid=chartofacc.accid) as mfacr
    ,nvl(debit,0),nvl(credit,0),voumaster.entdate,voumaster.vno from chartofacc ,accbal,voudetail,voumaster where chartofacc.accid=accbal.accid(+) and chartofacc.accid=voudetail.accid(+) and voumaster.vno=voudetail.vno order by chartofacc.accid,voumaster.entdate,voudetail.VNO;
    Sir I need add opbal from master section to debit in detail section when new group start only after adding I use that column for accumulative total or running balance
    If I get any method when group change system give me any key or indication then I use
    Please give me idea in both field oracle sql and oracle report 6i
    Thank
    aamir

    Hi,
    Please send tables structures and sample data from that tables. And, of course what should be the output. :) Just sending your query won't help us to find a solution.
    Peter D.

  • Crosstab Query re Grouping Data into Value Ranges

    Hi
    I am trying to analyse some data in a Crosstab & have a query re grouping.
    The data contains sales transaction info such as selling price, quantity etc. I would like to create a grouping in the Crosstab based on a sale price range (eg £0 - £10, £10 - £20 etc) so that I can show the total quantity sold in each price range.
    To date my method has been to create a formula with Select Case which identifies each transaction into a price range. I would then use this formula in my Crosstab. The main issue with this method is that there will be a large number of Cases & the possibility this will need to be added to / modified going forward.
    Whilst I think this will work I am hoping there is better method to follow?
    Thanks
    Jon

    Hi Jamie,
    Thank you for your help.
    I'm looking to group in increments of 10 so it looks like the Floor function will do the trick, thank you.
    I'll probably use an If statement to do a "block" of prices at either end of the scale (ie < 100 then 100, > 1000 then 1000+ else Floor ({Sales Field},10). Hopefully this way I'll reduce the overall no of rows.
    Thanks again for your help.
    Jon

  • Hierarchical Tree Data Query/Record Group Question

    I need help with Hierarchical Forms right now. I'm currently trying to implement a hierarchical tree to display the different items in different categories. I have been reading up on it for the past few days, and i do not understand a few things.
    What is the difference between a data query and record group? they seem the same to me.
    How does the XX = prior XXX work? i understand that this is what connects the parent to the child.
    How do you determine what depth the node is? its done in the record group/data query, but how do i decide what level it is dynamically?
    Thanks a lot in advance!

    Thanks! I am unable to create a table specifically for the tree because i am using tables that have been ported live and are in use. My question about levels is how do I know which depth the node is. For example, i have a category called Information Technology and a category item called Business Informatics. I want to know how to decide that the Category(information technology) is on level 1 and the Item(business informatics) is on level 2.
    Information Technology
    |_
    Business Informatics
    And i do know how the Connect By XX = prior XXX works in the data query/record group.
    Thanks for your help!

  • Sqlserver query using Group by and Order by

    SUM(BILL_DETAIL.x_bill_quantity) as BILL_QUANTITY,
    MIN(BILL_DETAIL.x_billable_to) as BILLABLE_TO,
    MIN(BILL_DETAIL.x_billable_yn) as BILLABLE_YN,
    AVG(BILL_DETAIL.x_bill_rate) as BILL_RATE,
    MIN(BILL_DETAIL.x_cost_rate) as COST_RATE,
    MIN(BILL_DETAIL.x_cost_total) as COST_TYPE,
    LISTAGG(BILL_DETAIL.objid, ',') WITHIN GROUP(ORDER BY BILL_DETAIL.objid) as ID_LIST
    FROM table_x_gsa_bill_detail BILL_DETAIL
    WHERE (1=1)
    GROUP BY (DECODE(BILLABLE_YN, 1, 'Billable', 'Non-Billable') || ',' || BILLABLE_TO || ',' || DETAIL_CLASS || ',' || COST_TYPE || ',' || BILL_RATE)
    ORDER BY DECODE(BILLABLE_YN, 1, 'Billable', 'Non-Billable') || ',' || BILLABLE_TO || ',' || DETAIL_CLASS ||
    ) dt WHERE rn BETWEEN 0 AND 1
    Can any one pls help me using of Case Condition keyword instead of Decode in the above query ??? iam not able to convert above query for group by and order by..
    Actually i need to do group by the aggragate values which i got the values from the fields of BILLABLE_YN,BILLABLE_TO,DETAIL_CLASS, COST_TYPE, BILL_RATE.
    where as in oracle i can run above query using decode keyword where as in sqlserver iam not able to use BILLABLE_YN field alias of above query in group by .
    i tried like by using following way but it is wrong because here iam not using aggragate values of fields in group by funtion please help me in converting query in sqlserver. GROUP BY (case BILLABLE_YN when 1 then 'Billable' when 0 then 'Non-Billable' else
    'Non-Billable' End BILLABLE_YN + ',' + BILLABLE_TO + ',' + DETAIL_CLASS + ',' + COST_TYPE + ',' + BILL_RATE)
    Krishna

    CREATE TABLE DETAIL
    ([objid] int,[x_billable_to] varchar(19), [x_bill_quantity] int,
    [x_billable_yn] int, [x_bill_rate] int, [COST_TYPE] varchar(19) )
    INSERT INTO
    DETAIL
    ([objid], [x_billable_to], [x_bill_quantity], [x_billable_yn], [x_bill_rate],[COST_TYPE])
    VALUES
    (1, 'Customer', 3, 1, 20,'Parking'),
    (2, 'Customer', 1, 1, 25,'Toll'),
    (3, 'Customer', 2, 1, 20,'Parking') 
    Pls convert following query for executing query in sqlserver  ..for the column ID_List it should return data like 1,2,3
    SELECT * FROM (SELECT 1 rn,
            SUM(BILL_DETAIL.x_bill_quantity)      as BILL_QUANTITY,
            MIN(BILL_DETAIL.x_billable_to)        as BILLABLE_TO,
            MIN(BILL_DETAIL.x_billable_yn)        as BILLABLE_YN,
            AVG(BILL_DETAIL.x_bill_rate)          as BILL_RATE,
            LISTAGG(BILL_DETAIL.objid, ',') WITHIN GROUP(ORDER BY BILL_DETAIL.objid) as ID_LIST
         FROM   BILL_DETAIL
          WHERE (1=1)
     GROUP BY (DECODE(x_billable_yn, 1, 'Billable', 'Non-Billable') + ',' + x_billable_to  +  ',' + COST_TYPE + ',' + x_bill_rate)
          ORDER BY DECODE(x_billable_yn, 1, 'Billable', 'Non-Billable') + ',' + x_billable_to  +  ',' + COST_TYPE + ',' + x_bill_rate
           )dt 
    WHERE rn BETWEEN 0 AND 1
    Krishna
    sounds like this
    SELECT *
    FROM
    SELECT 1 rn,
    SUM(BILL_DETAIL.x_bill_quantity) as BILL_QUANTITY,
    MIN(BILL_DETAIL.x_billable_to) as BILLABLE_TO,
    MIN(BILL_DETAIL.x_billable_yn) as BILLABLE_YN,
    AVG(BILL_DETAIL.x_bill_rate) as BILL_RATE,
    LEFT(bd1.ID_LIST,LEN(bd1.ID_LIST)-1) AS ID_Listing
    FROM BILL_DETAIL bd
    CROSS APPLY (
    SELECT BILL_DETAIL.objid + ',' AS [text()]
    FROM BILL_DETAIL
    WHERE objid = bd.objid
    FOR XML PATH('')
    )bd1(ID_LIST)
    WHERE (1=1)
    GROUP BY (CASE WHEN x_billable_yn = 1 THEN 'Billable' ELSE 'Non-Billable'END + ',' + x_billable_to + ',' + COST_TYPE + ',' + x_bill_rate),
    LEFT(bd1.ID_LIST,LEN(bd1.ID_LIST)-1)
    ORDER BY (CASE WHEN x_billable_yn = 1 THEN 'Billable' ELSE 'Non-Billable'END + ',' + x_billable_to + ',' + COST_TYPE + ',' + x_bill_rate),
    LEFT(bd1.ID_LIST,LEN(bd1.ID_LIST)-1)
    )dt
    WHERE rn BETWEEN 0 AND 1
    Please Mark This As Answer if it solved your issue
    Please Vote This As Helpful if it helps to solve your issue
    Visakh
    My Wiki User Page
    My MSDN Page
    My Personal Blog
    My Facebook Page

  • Query Help-2

    Query Help:
    http://forum.java.sun.com/thread.jsp?forum=45&thread=471180&tstart=15&trange=15
    It seems I have confused enough people with my improper presentation of query. Sorry guys. I will restate my question with different table names.
    The above was my previous posting, which was not clear..so Iam restating my problem as follows....
    I have the following tables
    Customer(custID, Name, Address)
    Order(custID, OrderID, orderDate)
    CreditCard(custID, creditCard#, creditCardType)
    Now if I have 3 records in Order with custID 100 and 2 records in CreditCard as
    Order:
    100,A001,11/22/03
    100,A002,11/24/03
    100,A003,12/02/03
    CreditCard:
    100,42323232..., VISA
    100,5234234...., MASTER
    Now how can I get
    custID, Name, Address, OrderID, orderDate, creditCard#, creditCarType
    data in minimum no. of records....
    I think I have made my query clear..
    now please help me guys...
    thanks so much for your help.

    You are right.
    But frankly the actual tables on my database are not customer,orders and creditcards..but I just tried to reproduce the problem with these tables, please ignore that user needs a refund etc situtaion. If the tables were actually order,creditcards etc..it would have been a problem to be considered.
    Can you please help me with the query
    if I have m rows in Order and n rows in CreditCard. I will get m*n records, I looking for max(m,n).
    With the following fields in my query result,
    custID, Name, Address, OrderID, orderDate, creditCard#, creditCarType
    from Customer, Order, CreditCard tables
    Thanks so much for your htlp

  • SQL Query Help - Is this possible or impossible????

    Hi guys,
    I need help with an SQL query that I'm trying to develop. It's very easy to explain but when trying to implement it, I'm struggling to achieve the results that I want.....
    For example,
    I have 2 tables
    The first table is:
    1) COMPANY create table company (manufacturer varchar2(25),
                                                          date_established date,
                                                          location varchar2(25) );My sample test date is:
    insert into company values ('Ford', 1902, 'USA');
    insert into company values ('BMW', 1910, 'Germany');
    insert into company values ('Tata', 1922, 'India');The second table is:
    2) MODELS create table models (manufacturer varchar(25),
                                                 model varchar2(25),
                                                 price number(10),
                                                 year date,
                                                 current_production_status varchar2(1) ) ;My sample test data is:
    insert into models values ('Ford', 'Mondeo', 10000, 2010, 0);
    insert into models values ('Ford', 'Galaxy', 12000,   2008, 0);
    insert into models values ('Ford', 'Escort', 10000, 1992, 1);
    insert into models values ('BMW', '318', 17500, 2010, 0);
    insert into models values ('BMW', '535d', 32000,   2006, 0);
    insert into models values ('BMW', 'Z4', 10000, 1992, 0);
    insert into models values ('Tata', 'Safari', 4000, 1999, 0);
    insert into models values ('Tata', 'Sumo', 5500,   1996, 1);
    insert into models values ('Tata', 'Maruti', 3500, 1998, 0);And this is my query:
    SELECT
            com.manufacturer,
            com.date_established,
            com.location,
            DECODE(nvl(mod.current_production_status, '0'), '0', '-', mod.model),
            DECODE(nvl(mod.current_production_status, '0'), '0', '-', mod.price),
            DECODE(nvl(mod.current_production_status, '0'), '0', '-', mod.year),
            mod.current_production_status
    FROM
           company com,
           models mod
    WHERE
          mod.manufacturer = com.manufacturer
          and com.manufacturer IN ('Ford', 'BMW', 'Tata')
          and mod.current_production_status IN (1,0)
    ORDER BY
            mod.current_production_status DESCWhat I want the query to output is this:
    com.manufacturer        com.date_established          com.location          mod.model          mod.price             mod.year     mod.current_production_status
    Ford               1902                    USA               Escort               10000               1992          1
    BMW               1910                    Germany               -               -               -          0
    Tata               1922                    India               Sumo               5500               1998          1If current_production_status is 1 it means this particular model has been discontinued
    If current_production_status is 0 it means the manufacturer does not have any discontinued models and all are in procuction.
    The rule is only one record per manufacturer is allowed to have a current_production_status of 1 (so only one model from the selection the manufactuer offers is allowed to be discontinued).
    So the query should output the one row where current_production_status is 1 for each manufacturer.
    If for a given manufacturer there are no discontinued models and all have a current_production_status of 0 then ouput a SINGLE row that only includes the data from the COMPANY table (as above). The rest of the columns from the MODELS table should be populated with a '-' (hyphen).
    My query as it is above will output all the records where current status is 1 or 0 like this
    com.manufacturer        com.date_established          com.location          mod.model          mod.price          mod.year     mod.current_production_status
    Ford               1902                    USA               Escort               10000               1992          1
    Tata               1922                    India               Sumo               5500               1998          1
    Ford               1902                    USA               -               -               -          0                    
    Ford               1902                    USA               -               -               -          0
    BMW               1910                    Germany               -               -               -          0
    BMW               1910                    Germany               -               -               -          0
    BMW               1910                    Germany               -               -               -          0
    Tata               1922                    India               -               -               -          0
    Tata               1922                    India               -               -               -          0However this is not what I want.
    Any ideas how I can achieve the result I need?
    Thanks!
    P.S. Database version is '10.2.0.1.0'

    Hi Vishnu,
    Karthiks query helped...
    But this is the problem I am facing...
    SELECT
            com.manufacturer,
            com.date_established,
            com.location,
            DECODE(nvl(mod.current_production_status, '0'), '0', '-', mod.model),
            DECODE(nvl(mod.current_production_status, '0'), '0', '-', mod.price),
            DECODE(nvl(mod.current_production_status, '0'), '0', '-', mod.year),
            mod.current_production_status
    FROM
           company com,
           models mod
    WHERE
          mod.manufacturer = com.manufacturer
          and com.manufacturer = 'Ford'
          and mod.current_production_status IN (1,0)
    ORDER BY
            mod.current_production_status DESCThe value of:
    and com.manufacturer = 'Ford'will be dependent on front end user input....
    When I run the query above I get all the rows where current_production_status is either 1 or 0.
    I only require the rows where current_production_status is 1.
    So if I amend it to look like this:
         and mod.current_production_status = 1This works....
    BUT if a user now passes in more than one manufacturer EG:
    and com.manufacturer IN ('Ford', 'BMW')The query will only return the one row for Ford where current_production_status is 1. However because BMW has no models where current_production_status is 1 (all 3 are 0), I still want this to be output - as one row....
    So like this:
    com.manufacturer        com.date_established          com.location          mod.model          mod.price             mod.year     mod.current_production_status
    Ford               1902                    USA               Escort               10000               1992          1
    BMW               1910                    Germany               -               -               -          0So (hopefully you understand), I want both cases to be catered for.....whether a user enters one manufacturer or more than one...
    Thanks you so much!
    This is really driving me insane :-(

  • Query Designer - Query:Specialist Group Status

    Hi Gurus,
    One of my BI user is getting error in this:
    In Query Designer - Query:Specialist Group Status
    "Registered JIT debugger is not avialable. An attempt to launch a JIT debugger with the following
    command resulted in an error code of 0x2(2). please check computer settings.
    cordbg.exe !a 0x289c"
    but when I tried with SUPER USER access i am not getting above error.
    Guys please suggest me asap
    Thanks
    sahad

    hello,
    Check the variabledefinitions of the query.
    Try RSRT and 'execute and debug'.
    It might be you get a lot more detailed information about the problem.
    see OSS note 961995.
    Regards,
    Dhanya

  • Assign SQ03 Abap Query User Group to role

    Please advise how to assign SQ03 Abap Query User Group to a role. Thanks.
    Moderator message: please do more research before asking.
    [Rules of engagement|http://wiki.sdn.sap.com/wiki/display/HOME/RulesofEngagement]
    [Asking Good Questions in the Forums to get Good Answers|/people/rob.burbank/blog/2010/05/12/asking-good-questions-in-the-forums-to-get-good-answers]
    Edited by: Thomas Zloch on May 12, 2011 5:40 PM

    Hello Sunil,
    The problem is that I have hundreds of users to maintain user groups.
    found out that it is possible to assign user group to role and role to user groups. implementing hr authorization with in-direct assignment of auth. So if I could use sq10, user groups could also be link to position in the org chart.
    sq10 does allow you to assign a user group to a role but when you assign the role to a user and the user runs a query, it reports that no user group has been assigned.
    Suspect that there must be a parameter or switch that is not turned on
    Regards

  • Need a query help

    hii
    i need a query help
    i have two tables
    the 1st table will look like this
    associate id weekid no.of. hours
    4000 810 40
    4000 820 30
    4000 830 60
    4000 840 70
    2nd table will look like this
    associate id weekid no.of.hours
    4000 810 40
    4000 820 70
    4000 830 130
    4000 840 200
    so when i subtract the last two records frm each other in the second table the value should be equal to the no.of.hours in the first table.. for example
    the query shud consider the last record and one before the last record and the difference between two records shud be equal to the value in the 1st table
    for example
    consider week id 830 and 840
    in second table 830=130
    840=200
    when u subtraced both values the difference shud be equal to value in the 1st table for tht week id
    1 ---->>>> 840 - 830
    =200 - 130
    =70
    in first table 840 has 70 hrs
    like this it shud check with all records and it shud return only the records which are not equal
    regards
    srikanth

    This..?
    sql>select * from t1;
    A_ID W_ID HRS
    4000  810  40 
    4000  820  30 
    4000  830  60 
    4000  840  70 
    4000  850  80 
    sql>select * from t2;
    A_ID W_ID HRS 
    4000  810  40 
    4000  820  70 
    4000  830  130 
    4000  840  200 
    4000  850  260 
    sql>
    select a_id,w_id,hrs,sum_hrs
    from(
    select t1.a_id a_id,t1.w_id w_id,t1.hrs hrs,t2.hrs sum_hrs,
           t2.hrs - nvl(lag(t2.hrs)  over(order by t1.w_id),0) diff
    from t1,t2
    where t1.w_id = t2.w_id)
    where diff != hrs;
    A_ID W_ID HRS SUM_HRS 
    4000  850  80  260                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • Querying user groups while using @RunAs on a bean

    Hi,
    I am trying to implement a scenario in which I have three entities:
    - bean A - datastore for all users
    - bean B - implementing logic, filtering results from datastore for specific user based on groups he is in
    - User - calling bean B
    Calling chaing is User -> bean B -> bean A.
    bean B has to query user groups and filter data based on that. I've implemented that using:
    Subject subject = Security.getCurrentSubject();
    for (Principal principal : subject.getPrincipals()) {
    if (principal instanceof WLSGroup) {
    Without any security specified (like @RolesAllowed) it works like charm.
    But I want to add security constraints to the beans:
    @RolesAllowed("admin")
    class A {}
    @RolesAllowed("user")
    class B {}
    The problem is that B cannot acces A methods because it is calling A using 'user' security context.
    I've thought I change it to:
    @RunAs("application")
    @RolesAllowed("user")
    class B {}
    "Application" is an account in group admin.
    Now B can call A. The problem is that security context is switched to "application" on entering B's methods. Inside them I cannot query user groups using method presented above, because I get "application" groups.
    Is there a way to change security context on calling other bean methods? Like using Security.runAs( somehowGetApplicationSubject(), runnable) ??
    Other method I've thought of, but I have no idea how to implement that, is somehow querying weblogic to get groups of SessionContext.getCallerPrincipal(), which returns user account regardless of using RunAs.
    Hope someone made through this problem before,
    Krzysiek

    getBounds() will only generally make sense while the component itself is being rendered. I wouldn't be completely surprised if the framework which gets that component also resets its size once it's done painting the thing.
    If you're calling it from outside the rendering loop, perhaps you could try calling validate() on the component, which should force it to determine its size.
    Failing that, you could possible use getPreferredSize() instead, which will likely obtain a similar result in most cases.

  • Grouped and non-grouped SELECT in one query: help!

    look first at: Wrong result when I use CASE on this forum. Here I wanted to get the user who created and the user who solved a problem (Lets call it Validation Error from now on (VE)).
    The thing is: I already have a query who returns me lots of information about a VE.
    The query in the previous thread returned me additional info about that VE (that is the creating_user and the solving_user). The 1st query is no group select, but the second is! Still, I need to combine those two in one query.
    1st query:
    select ve.seq,
         max((case vah.action when 'C' then vah.ur_code else null end)) created,
         max((case vah.action when 'S' then vah.ur_code else null end)) solved
    from validation_errors ve
    left outer join ver_action_histories vah
    on (ve.seq = vah.ver_seq AND ve.log_date = vah.ver_log_date)
    where ve.seq = 12860687
    group by ve.seq;Result:
    seq       | created | solved
    12860687    Bob       Bobdont mind the "where"-clause, it is just to make the query go faster
    what I do is: I join the VE with the ver_action_histories table which contains the users and what action they performed on a VE.
    Now I just want to add that information to the results of an other query which also returns lots of information about a VE.
    2nd query:
    select ve.seq "VE seq", mh.seq "Counter seq",
              ve.log_date, ve.solve_date, ve.solved Status, ve.failure_code, ve.mde_code,
              mh.meter_type,
              iv.mr_type, iv.mr_reason,
              ih.mmr_seq
    from validation_errors ve
    inner join meter_histories mh
    on (ve.mhy_seq = mh.seq)
    left outer join index_values iv
    on (ve.mhy_seq = iv.mhy_seq AND ve.log_date =iv.timestamp)
    left outer join index_histories ih
    on (ve.mhy_seq = ih.ive_mhy_seq)
    where ve.seq = 8653936
    and sysdate >= mh.start_date
    and sysdate < mh.end_date;dont mind the "where" and "and"-clauses ... I hope the result of this query will simplify things ...
    Result:
    seq        |   counter seq | log_date | solved_date | status    | failure_code | ...
    12860687       4568          1-jan-06   2-jan-06      Solved      ABCNow the actual question: Is it possible to combine those queries in one query? I just want the results of the first query (creating_user and solving_user) to be added as columns to the second result. Performance is very important. Please tell me that its possible?
    Wanted Result:
    seq        |   counter seq | log_date | solved_date | status    | failure_code | created  | solved  | ...
    12860687       4568          1-jan-06   2-jan-06      Solved      ABC            Bob        BobIf anything I explained is unclear, please tell so I can try to explain it in an easier way.

    Try an in line view:
    select *
    from
    ( <your first query goes here > ) a
    , ( <your second query goes here > ) b
    where a.seq = b.seq

  • Query using Group by - help needed

    I am having a query as follows:
    select id_nbr, stop_nbr, street || city || state, count(sub_stop_nbr)
    from details where created_date = ' 22-Jul-08';
    As group by clause is missing it is giving errors.
    But when I add group by to this query, I have to add all selected values.
    How can I add the concatenatd values here.
    Is there any other way rather than writing as :
    (select id_nbr, stop_nbr, street || city || state, count(sub_stop_nbr)
    from details where created_date = ' 22-Jul-08'
    group by id_nbr, stop_nbr, street || city || state)

    so where is the problem in writing:
    select id_nbr, stop_nbr, street || city || state, count(sub_stop_nbr)
    from details
    where created_date = ' 22-Jul-08'
    group by id_nbr, stop_nbr, street || city || state
    ????

  • Query help: query to return column that represents multiple rows

    I have a table with a name and location column. The same name can occur multiple times with any arbitrary location, i.e. duplicates are allowed.
    I need a query to find all names that occur in both of two separate locations.
    For example,
    bob usa
    bob mexico
    dot mexico
    dot europe
    hal usa
    hal europe
    sal usa
    sal mexico
    The query in question, if given the locations usa and mexico, would return bob and sal.
    Thanks for any help or advice,
    -=beeky

    How about this?
    SELECT  NAME
    FROM    <LOCATIONS_TABLE>
    WHERE   LOCATION IN ('usa','mexico')
    GROUP BY NAME
    HAVING COUNT(DISTINCT LOCATION) >= 2Results:
    SQL> WITH person_locations AS
      2  (
      3          SELECT 'bob' AS NAME, 'USA' AS LOCATION FROM DUAL UNION ALL
      4          SELECT 'bob' AS NAME, 'Mexico' AS LOCATION FROM DUAL UNION ALL
      5          SELECT 'dot' AS NAME, 'Mexico' AS LOCATION FROM DUAL UNION ALL
      6          SELECT 'dot' AS NAME, 'Europe' AS LOCATION FROM DUAL UNION ALL
      7          SELECT 'hal' AS NAME, 'USA' AS LOCATION FROM DUAL UNION ALL
      8          SELECT 'hal' AS NAME, 'Europe' AS LOCATION FROM DUAL UNION ALL
      9          SELECT 'sal' AS NAME, 'USA' AS LOCATION FROM DUAL UNION ALL
    10          SELECT 'sal' AS NAME, 'Mexico' AS LOCATION FROM DUAL
    11  )
    12  SELECT  NAME
    13  FROM    person_locations
    14  WHERE   LOCATION IN ('USA','Mexico')
    15  GROUP BY NAME
    16  HAVING COUNT(DISTINCT LOCATION) >= 2
    17  /
    NAM
    bob
    salHTH!
    Edited by: Centinul on Oct 15, 2009 2:25 PM
    Added sample results.

Maybe you are looking for

  • Is it still possible for me to buy the student creative cloud subscription?

    I am a student, but I also earn a bit of money in my freetime using an editing software similiar to Photoshop to complete a few design jobs. Since I think that Photoshop is way better and I need other programms too, I would like to buy the creative c

  • TS4644 How do I clear my saved autofill settings in iOS 7?

    I received the autofill pop-up for credit card information on a site, and I accidentally selected "Never" when it asked if I wanted to save it. I do want to save it and I tried turning everything on and off, but I can

  • Setting options do not appear when autofill is selected

    Greetings, I am trying to set my iPhone 5 to autofill with music, it seems like itunes just picks how much music to load? I would like to pick how much

  • Weblogic-Albpm enterprise Error

    Hi all , when i tried configuring ALBPM5.5 enterprise with weblogic ,i reached till the point JDBC data source properties. i am following "ALBPM_5-7_WebLogic_9-2_Installation.pdf" It explains step by step. All the steps went successful till the point

  • Error message when we process Service Warranties

    Hi Team, Not sure why user is facing the atatched error while processing the service warranties line type. While processing the Service Warranties line they tabbed through to the line and entered the line they wanted to connect to then tabbed through