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

Similar Messages

  • Retrieving spatial and non spatial data in one query

    Hello. I am having slight difficulties using JDBC to retrieve both spatial and non spatial data in the same query. The following is code from a sample program of mine that retrives spatial data from spatial tables.
    (In spatialquery geom is a geometry column and city is simply the name of the city):
    try
    Geometry geom = null;
    String database = "jdbc:oracle:thin:@" + m_host + ":" + m_port + ":" + m_sid;
    DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
    con = (OracleConnection)DriverManager.getConnection(database, sUsername, sPassword);
    GeometryAdapter sdoAdapter =
    OraSpatialManager.getGeometryAdapter("SDO", "8.1.7", STRUCT.class, null, null, con);
    String spatialquery = "SELECT a1.geom, a1.city \n" +
    "FROM cities a1";
    Statement stmt = con.createStatement();
    OracleResultSet rs = (OracleResultSet) stmt.executeQuery(spatialquery);
    int i = 0;
    int noOfFeatures = 2;
    while (rs.next())
    for(i = 1; i <= noOfFeatures; i++)
    STRUCT dbObject = (STRUCT)rs.getObject(i);
    try
    geom = sdoAdapter.importGeometry(dbObject);
    catch(GeometryInputTypeNotSupportedException e)
    System.out.println("Input Type not supported");
    catch(InvalidGeometryException e)
    System.out.println("Invalid geometry");
    System.out.println(geom);
    }//end while loop
    This retrieves the sptial data fine, however when I attempt to retreive the non-spatial data I keep getting a "ClassCastException" error. I understand it is something to do with "STRUCT dbObject = (STRUCT)rs.getObject(i);" line. Can anyone tell me how to retrieve both spatial and non-spatial data in the one query using JDBC. I have tried nearly everything at this stage. Cheers joe

    Theresa A Radke
    Posts: 20
    OTN Member Since: Jul, 2001
    retrieving spatial and non spatial in same query. May 23, 2003 12:02 AM
    retrieving spatial and non spatial in same query.

  • Singapore - Employee Group and Sub groups

    Hi Gurus
    While making employee groups and sub group for SG what factors should one keeep in mind??

    Hi,
    When we are assigning the employee groups to sub groups select 25 singapore country allowed in the table V_T503Z.
    that factor we need to remember.
    Good luck
    Devi

  • Primary Group and Additional Group in Solaris 10

    hi!
    We've just freshly installed a Solaris 10 system. I'm very new in Solaris. There's something i noticed, and i'm not sure whether is that normal.
    In the user screen in solaris management console, i notice that i'm not able to see the Primary group and additonal group list. What i can see is only the Primary group in ID format. I'm able to see it only the first time when i launch the Solaris management console or switch from one workplace to another. After right clicking on the user properties for the second time, it disappear and show only the primary group id in integer. On the left hand side of the screen, it says "The group cannot be listed. You can change the primary group 10 to another valid integer. Because of error or oversight, group membership cannot be found. You can enter a number for the primary group, but cannot choose from a list of groupnames. Also you cannot choose Seconday Group until the group info is available". "Check group files, NIS maps, or load for possible corruption. If you have not already populated appropiate files or maps, See administrator guide, Naming and Directory Services(DNS, NIS, LDAP) or docs.sun.com for LDAP see also Solaris Management console help, about the toolbox editor to manage LDAP"
    Is that normal? What could be wrong here? Please advise. Thanks.

    hi! Anyone can provide advise on the issue i encountered?

  • Default excise group and series group issue

    Hi Gurus
    I have a doubt. Is it possible to maintain the default excise group and series group in this order
    sales org     dis chnl    division    ship pt    plant    excise group    series group
    1000               EX         CD             1000     1000       10                       A1
    1000               EX         CD             1000     2000       20                       A2
    i tried this combination, but getting the error message that a key already exists....The header data sales area and shipping point already exists.... I cant understand why we cant give the same sales area and shipping point for a new plant combination
    Thanks in advance
    Mathan

    Hi Mathan,
    When we say Excise group then it is maintained for the plant as it is maintained with Excise authorities. We can have same shipping point for 2 different plants but the possibilities are less and when 2 plants share the resources and facilities then those plants are registered as a single excise entity with the authorities. That is the reason that the option of having the same sales area and shipping point as header data is not allowed for more than one excise group. This is more business related than SAP.
    Hope this clarifies the doubt.
    Regards,
    Antima

  • Is it possible to add value item and non stock item in one billing?

    Is it possible to add value item and non stock item in one billing?

    Hi,
    Yes,it is possible .Take example of service scenario,where material used in servicing and service charges(labour) can be billed in single invoice.
    Billing document type,Customer and other header data should be same.
    Reward points if useful
    Regards,
    Amrish Purohit

  • Creation of new employee groups and sub groups

    Hi All,
    What all the steps should I follow to create new employee groups and sub groups? and  How many structures should I create for this?
    Its urgent pls.......
    Good replies will be rewarded!!!!
    Regards,
    Sita

    Hi
    You can create the employee groups depending up on your clients requirement, Eg: Permanent, Temporary, Seasonal, Trainee, Advisor etc
    And define the employee subgroups and assign them to the employee groups Like
    Enterprise structure>Definition>Human Resource Management-->Employee Groups & Employee Groups
    Enterprise structure>Assignment>Human Resource Management-->Assign employee subgroup to employee group
    you can create employee subgroups depending up on your requirement like asst manager, manager, GM, MD, VP ETC an assign them to the employee subgroups ok.
    Ensure that certain empployee subgroups may not be assigned to employee group based on requiremen, but create all the employee sub groups which is existing in the organization.
    Regards

  • Change employee group and sub group

    Hi all,
    During the new hire if an employees group and subgroup are enetered wrongly, how shouldl they be corrected. We have scenarios when the emplooyes group and sub group are corrected after a month or so and the users want to correct the same
    How do we do it?

    Goto PA40 reselect the same Hire action for this employee and click execute. In IT0000 screen enter the new EG/ESG.
    and save it. Then Save the IT0001, then fill rest of the infotypes.
    If you have already process the payroll and the new Emp group / Sub group is in different payroll area you wont be able to change it.

  • HT1420 What will the screen show when I deauthorize all computers?   Will it show them and then I select the ones to authorize?  I don't want to undo or be unable to re-authorize the ones I still want.

    What will the screen show when I deauthorize all computers?   Will it show them and then I select the ones to authorize?  I don't want to undo or be unable to re-authorize the ones I still want.

    "What will the screen show when I deauthorize all computers?  "
    Nothing.  Not sure what you mean.
    " Will it show them and then I select the ones to authorize? "
    No.
    You have to authorize a computer from that computer.  You cannot authorize a computer from another computer.

  • Valuation Group and Tolerance Group - FS00

    Hi all,
    Can someone please tell me what the field 'valuation group' and 'tolerance group' are used for? I've found a brief description online, but if you could provide me with an example that would be great.
    thanks,

    Hi
    We will use Tolerance group for below mentioned activities
    the maximum document amount the employee is authorized to post
    the maximum amount the employee can enter as a line item in a customer or vendor account
    the maximum cash discount percentage the employee can grant in a line item
    the maximum acceptable tolerance for payment differences for the employee
    For Valuation Group suggest you to refer below links
    Valuation group code in Account determination?
    Regards
    Praveen

  • What is meant by article grouping and site grouping and how to define

    what is meant by article grouping and site grouping and how to define in SAP.

    Hi Charan,
               Article Grouping in its broader sense  means grouping of Articles for ease of maintenance and business functions, either on the basis of Hierarchy or on the basis of Merchandise Category.Article Grouping is also primarily useful in promotions,wherein you can define a set of articles(which may not necessary fall under the same MC or Hierarchy) and club them together and assign them in a promotion.Txn codes used are : VBG1/2/3 - Create/Change/Display Article Group
    For more information refer the link below
    http://help.sap.com/saphelp_47x200/helpdata/en/12/08485c470311d1894a0000e8323352/frameset.htm
    Site Grouping is used for ease of maintenance by grouping the sites.It is also used to maintain the characteristics as well.This can also be used in Allocation Tables,promotion and Listing etc
    Some of the Txn codes -
    WB50 - Site Group,Create Alloc,.table
    Wb56 - Site Group, Alloc.table,Maintain Sites in Class
    WB60 - Site Group,Create Promotions
    WB64 - Site Group,Maintain SItes to Class
    Wb80 - Create Site Group Other
    For more information,refer the link below
    http://help.sap.com/saphelp_47x200/helpdata/en/12/08485c470311d1894a0000e8323352/frameset.htm
    Hope it helps
    Rgds,
    Aram K.
    For more information refer to the link below

  • Very Urgent Extn.Material Group and Material Group.

    Hi Guru's,
          I was created Generic D.S Using table (AFRU) for Orders Confirmation.I was Created Info Source AND ODS.
         I nedd to maitain ODS Extn.Material Group and Material Group.but These fields are not Avilable in Data Source (AFRU Table not having).
        Data source having Field AUFNR (order number) I was mapped To BW Object 0prodorder. I was maitained master data for 0prodorder.
      0prodorder master data (0prodorder_attr) having 0material (PLNBEZ Field mapeed to 0material) as a navigational Attribute.
    i am asking to all is it possible to bring Extn.Material Group and Material Group update rule level using master data attribute option?
    Please help to me Above issue.it's very urgent.
    Thanks & Regards,
    Guna.

    Hi Manju & Gopi,
        This Order Confirmations cube having data from 2 data sources.
        There is a performence issue to clubbing so many tables.
         Any way i was maitained 0material is attribute(Nav Attr) of 0proorder.i was loaded 0prodoreder master data.
       0material having master data .Extn mat group & Material group are Nav Attributes of 0material.
      Now is it possible to maitaining the data in cube Extn mat group & Material group ?
    Please Give me Suggestion with out adding another table using view.
    Thanks & Regards,
    Guna.

  • Customer group and price group mapping

    Hi All ,
    I want to know where do we set the mapping for the customer group versus price group in the system .
    Is there any customizing t-code for this?
    Please advice.
    Thanks in advance,
    Swati

    Dear Swathi,
    There is no T-Code for Setting Customer Group and Pricing gorup in Customizing
    But we assign generally this two in front end due to requirements,
    like we consider in this two in Pricing condition creation in VK11, here suppose we maintain Key Combination in Customer Group and Pricing Group then we consider
    Hope this may helps you
    Prem.

  • I m trying to import some picture from my iphoto library but element 12 don't show me the iphoto dialog box , as I can see on my classroom book and in many tutorial.any one can help please

    I m trying to import some picture from my iphoto library but element 12 don't show me the iphoto dialog box ,where i choose what i want to import,  as I can see on my classroom book and in many tutorial.any one can help please ? thanks

    I have the same problem... but the photo library is neither on my iPhone or my Computer!! Please help.. its taking too much space.

  • User Groups and non Developers users

    Hi,
    two questions.
    1) How do I create users groups.
    I want to divide specific users to specific groups.
    2) I created users not as developer and not as a administrator.
    When I logged on with that users I didnt see any of the applications, why?
    Thanx.

    1. You asked "how do I assign users to that group and later attach the group..." I think your question is not about how to assign users to a group but rather how to attach the group... Use the function wwv_flow_fnd_user_api.user_in_group in an authorization scheme (desc wwv_flow_fnd_user_api). Attach the scheme to a region, button, etc. to control access. Please read about authorization schemes in the user guide and search this forum for "authorization" and "groups" for useful threads.
    2. A user account without development privilege will be useful for authenticating to an application you create. It will not be useful for developing any applications in the Application Builder.
    Scott

Maybe you are looking for

  • Error in Starting DMS(Content Server)

    Dear all, I get the following error while starting the Content server on unix. i am unbale to start the server , pls assist. $ pwd /home/sapcs/bin $ apachectl start ld.so.1: httpd: fatal: libucb.so.1: open failed: No such file or directory Killed $ R

  • Using ITunes Store with Windows Vista

    I seem to be having a problem with downloading my songs. I keep receiving an error message (err. 3259) and I have already paid for my downloads. Now what?

  • Problem in calling stored Procedure through Toplink

    Hi , I'm doing POC of calling stored thru toplink but facing some issues. Any pointers to it would be helpful. This is my javaCode used to call stored proc through toplink:- StoredProcedureCall call = new StoredProcedureCall(); call.setProcedureName(

  • Imac keyboard on windows freezes up

    hi my imac is being a pain when ever im in windows at anytime at random i hear the little windows jingle my keyboard freeezes and the caps lock button turns on the way to fix it temporarily is to replug it in i also have a macbook and i checked the d

  • Double buffering issue

    I have a complex modal JDialog with many JTextFields. Before it becomes visible I call setText("") on these fields to reset their values. When the dialog appears for the second time I see for a moment the old values of these fields. There is no such