Query Generation

DB : 10.2
Have two tables
1st Table : POS_ROLES
POS_ROLE_ID     
POS_ROLE_DESCRIPTION
LAST_UPDATE_BY
LAST_UPDATE_TS
ISACTIVE
2nd Table : gbl_user_profile
USWIN
POS_ROLE_ID     
Would like to generate the output for all the roles, will description and count of users where they have granted with the roles..
SELECT a.pos_role_id pos_role_id, a.pos_role_description pos_role_description, a.isactive isactive, count(a.pos_role_id) count
FROM
postp.pos_roles a,
postp.gbl_user_profile b
WHERE
a.pos_role_id = b.pos_role_id
group by a.pos_role_id, a.pos_role_description, a.isactive
order by a.pos_role_id ;
By using above query getting output of all the roles which has been granted but not which is not granted.
Any suggestion ?

Hi,
!st - dont use to old Ansi Standard for the join.
2nd - Where condition should be use to filter the rows not to join the tables
SELECT pos_role_id, A.pos_role_description, A.isactive, COUNT (pos_role_id) COUNT
FROM postp.pos_roles A LEFT OUTER JOIN postp.gbl_user_profile b
USING (pos_role_id)
GROUP BY A.pos_role_id, A.pos_role_description, A.isactive
ORDER BY A.pos_role_id;
OR
SELECT Apos_role_id, A.pos_role_description, A.isactive, COUNT (B.pos_role_id) COUNT
FROM postp.pos_roles A LEFT OUTER JOIN postp.gbl_user_profile b
ON (A.pos_role_id=B.pos_role_id)
GROUP BY A.pos_role_id, A.pos_role_description, A.isactive
ORDER BY A.pos_role_id;
Regards
Sandy

Similar Messages

  • Ad-hoc query generation question

    I have a LTS which has 5 tables -
    Item,
    Purchase_Categories,
    Order_Management_Categories,
    Inventory_Categories,
    Costing_Categories
    Now each %_categories table is joined to Item table in physical layer. In the LTS however, each %_Categories table has an outer join with the Item table so that if a category does not exist, the item is still displayed.
    When I run a query where I select a column from Item and a column from Purchase_Categories, OBIEE still generates a query
    SELECT ITEM.COLUMN1,
    PURCHASE_CATEGORIES.COLUMN2
    FROM ITEM left outer join purchase_categories ON ...
    left outer join order_management_categories ON ...
    left outer join inventory_categories ON...
    left outer join costing_categories ON ....
    I was expecting that OBIEE would generate a query select only the tables which were need i.e. the expected query was -
    SELECT ITEM.COLUMN1,
    PURCHASE_CATEGORIES.COLUMN2
    FROM ITEM left outer join purchase_categories ON ...
    I have seen that in some cases, OBIEE selects only the table that is required to generate the join based on the column selected, even though there are multiple tables in the joined in the LTS i.e. if the query is selecting columns from only 1 table and there are 2 tables in the LTS, OBIEE generates a query with only one table which has the column being selected.
    Why this difference in behavior during query generation ? Why does OBIEE intelligently select a specific table from the LTS definition some case and in other cases does not ?

    In case of outer join oracle applied all the join conditions defined among LTes. In normal joins it is able to figure out the correct source for column and does the trimming.
    Edited by: user596996 on Mar 20, 2009 6:33 AM

  • Query Generation for no apparent reason??

    When looking at the statistics in 0TCT_C02, we have noted that our queries regenerate or optimize multiple times each day.  I have tested this with a single query and I was sure to go into RSRT and turn off the optimization option.  Exceedingly longs times in 0TCT_C02 for event 3010 (OLAP: Query Generation).  We are talking times on the order of 45 seconds. I know that each query is supposed to be regenerated once every 31 days by default.  What else could be triggering this behavior?
    Examples:
    Date Time (HH:MM)   OLAP Gen Time (3010) from view RSDDSTAT_OLAP
    11/10/08  00:00     0.207153
    11/10/08  01:06     46.295823
    11/10/08  02:17     0.382898
    11/10/08  02:22     0.047491
    11/10/08  03:00     0.527515
    11/10/08  03:00     0.037425
    11/10/08  03:00     0.031306
    11/10/08  03:00     0.031065
    11/10/08  03:00     0.030289
    11/10/08  12:26     27.802359
    11/10/08  12:56     0.148548
    11/10/08  13:04     0.255053
    11/10/08  13:08     0.345807
    11/10/08  13:08     0.033123
    11/10/08  13:08     0.032887
    11/10/08  13:14     0.448533
    11/10/08  13:14     0.074349
    11/10/08  13:14     0.043456
    11/10/08  13:14     0.040294
    Why would it regenerate multiple times a day?  How do we get this to stop or at least control it better?
    (The query itself has not been changed since August of this year).
    Thanks for any info:
    Mitchell

    Hi there.
    The reasons why a query is regenerated :
       - Template changed                                     
       - Does generated report exist                          
       - Infoprovider changed                                 
       - Key figure / chararacteristic changed or deleted     
       - Report definition changed                
    If you are loading data regularly during the day, this may cause the regeneration to occur. SAP Note 1137994 should be helpful for this. SAP Note 1056259 talks about query generation and has further Notes for optimization. See section 4.
    Hope this helps,
    Karen

  • Report for query generation

    Hi,
    Is there any report available in BI for Query generation based on particular cube/multiprovider/ods.
    One way to do so is to go to RSRT & type in query name and generate it.
    But we have a large number of query's defined on a particular cube so we want a report that can help is to achieve the same for mass query generation.
    I have seen the report but i am missing the report name, can anyone help me to achieve the same.
    thanks
    dipika

    HI Sreekanth S :
    Thank for your giving , If  the operation  When i excute u201CRSR_GEN_DIRECT_ALL_QUERIESu201Dand input the name of my query equal to the function which i  generate reports in "RSRT"?
    Hope for your help.
    Thanks.

  • Re: query generation

    Hi there. Just something really quick. I am currently in the process of implementing automatic query generation. Oracle Spatial provides the Spatial Index Advisor as a relatively simple mechanism for viewing spatial data. When you make a spatial query you can view the structure of the query you just made in an SQL syntax. Is the sample code for generating these different queries in SQL made available anywhere on the Oracle site. Thanks Joe

    Hi
    In R/3 first you need to create the query in any of the below as you wanted it.
    Tcodes:
    quick query creation:  sqvi
    sq01--user group creation
    sq02--info set
    sq03--query creation
    Then after creating the query now create an generic data source, while creating
    give the option as SAPquery and now your data source is ready
    Hope this would be help ful
    Many thanks
    kiran
    Edited by: Kirun k on Jul 8, 2009 12:20 PM

  • Automation of Query generation and Conversion to Flat File CSV

    I have a requirement for Generating / Executing the refresh for the existing Query IN BEX automatically on 3 rd Business day of Every Quarter in BEX Analyzer AND also to convert it to flat file after generation. Please give me some documents or exact steps on how to go about this
    automation. Please reply me in detail and soon
    Thanks
    Soniya

    Hi Sir, I will be very grateful if u can clarify
    1. User want the flat  file on the Company Server, which means there are folder on my company BMW server , and he wants to see the flat file there so that he can review it
    2. I saw some AL11 and directories how can I create my directory or Create the file in DIR_HOME and see the file in flat file format it shows like a screen which my user do not want, he just want a flat file.
    3.Please suggest me if this method rscrm_bapi will work or should u suggest download scheduler or report agent and how.
    4. Sorry for the question but my problem and requirement of user is not solved
    please reply soon
    thanks
    soniya

  • Physical query generation: unneeded dimension tables get joined to the fact

    Hi there!
    The setup is the following:
    There is a logical fact table which is joined to 7 logical dimensions, it has 4 table sources which correspond to different time dimension levels (all other dimensions are mapped to Detail level).
    Time dimension logical table also has 4 different table sources (for days, months, quarters, and years).
    The data source is an Oracle Database 11gR2.
    The problem is:
    No matter what the logical query is, in the physical query all 7 joins are performed, even if the resulting data is then simply discarded. This results in very bad query performance.
    I feel that it is somehow related to the level-based fragmentation (since, for instance, inclusion of time dimension columns in SELECT list (not in WHERE) seems to affect physical queries), but lack sufficient knowledge to solve this problem or put up with it.
    My questions are the following:
    1) Have you ever encountered such a situation?
    2) Can unneeded joins be eliminated?
    2.1) If yes, how?
    2.2) If not, then why are they needed?
    Thanks in advance!

    Physical level:
    D01-D06 - ordinary physical tables.
    D_DATES - all time levels from dates to years, D_MONTHS - time levels from months to years, also D_QUARTERS and D_YEARS.
    F_DAILY - fact table joined to all of the D01-D06 and to D_DATES, F_MONTHLY - joined to D01-D06 and D_MONTHS, also F_QUARTERLY and F_YEARLY. All measure columns are the same.
    Logical level:
    D01-D06 correspond to ordinary logical tables with a single table source. Logical dimensions are created.
    D_TIME is a logical time dimension with four levels (dates, months, quarters, and years) and four table sources ( D_DATES, D_MONTHS, D_QUARTERS, and D_YEARS ).
    F is a fact table with four logical table sources ( F_DAILY, F_MONTHLY, F_QUARTERLY, and F_YEARLY ) with aggregation content levels set correspondingly.
    OBIEE correctly picks physical table sources for different time levels, but generates extremely inefficient SQL (joining all dimension sources in a WITH-subquery, doing ROW_NUMBER over a result set, and then discarding half the columns, which were not needed to start with).

  • Query Generation error

    Hi,
    I am getting following error when running query on browser
    "Error in generating dataprovider"
    This happened after I created a Bex request to edit query in Bex Designer. I edited query in designer and saved it. Then when i clicked on execute query I am getting the above error.
    Thanks in advance.

    hi raj..
    chk these links..
    these are same as that of urs.. hope this will help you to get a clue...
    Error when generating dataProvider
    Error generating Dataprovider
    all the best..

  • Rso2 infoset query  generation procedure

    How to generate data source in rso2 using infoset query to get distinct record

    Hi,
       Generating Datasource from Infoset is not different from Generating DataSource from View or Function Module.
    Create infoset in the source system from SQ02.
    go to RSO2. Provide the Datasource Name. go wiht create.
    Select the Infoset Push Button, provide description.
    provide the infoset Name. Let me know if you have any Issue.
    Save the DataSource. check RSA3 for Data.
    Regards,
    Nagesh Ganisetti.

  • Oracle BI Vs Sievel Analytics 7.8.x in Query Generation.

    Hi All,
    In Siebel Analytics 7.8.x if you have 10 columns in the Criteria and if you are using only two columns in the Pivot table view, the query is generated to using only columns used in Pivot view. Where as in Oracle BI it uses all 10 columns in the criteria.
    Is this a bug? Or any instanceconfig.xml parameter exists to control this behavior?
    Our Aim have different view (each view uses 2 or 3 columns) and use View Selector
    This is causing major issue in our project. Please let me know if any one faced this issue and how to resolve this.
    Thank you.

    Yes, you can you can keep your apps at 7.8 but use OBI EE 10g. For OBI EE the DWH created through the BI Apps is just a data source.
    One thing though: in order to be able to make full use of the 10g funtionalities regarding time series funcitons (todate and ago), you will need to fit your W_DAY_D dimension to the 7.9 standard. For that, please open anew post in the Apps forum since this discussion doesn't belong here. Business Intelligence Applications
    I'll post my documentation on the upgrade steps there then.
    As for upgrading Infa, this is a bit more tricky. You need to make suzre that DAC 7.8 can still fire all its commands at a 8.1.1. instance of Infa. (Haven't tried that one yet).
    Cheers,
    C.

  • Multiple Query Generation from Discoverer?

    Is there anyway we can generate multiple query reports in discoverer plus? I have a daily dashboard which we send out on daily basis which has multiple queries to generate certain numbers. And I have a stored procedure for this. Is it possible to have multiple queries in 1 workbook to generate the report? If yes, then how? If not then, can we have this stored procedure in disco admin tool in a specific business area which basically kicks the SQL and stores the data in a table within that business area and in disco plus tool we can then simply select all the data from that table to generate the report? I would really appreciate if anyone could answer this.
    Thanks,
    K

    Another interesting way you can prepare a table is a method I've just seen using Disco 4.x.
    We've made such a big deal on using triggers recently, that this was so simple, I must admit I never thought of it.
    What the user did was have a function that called a pl/sql routine that did all the work and created the table.
    Then in the Disco workbook, they specified workbook 1 - the first workbook that took in parameters from the users, and passed the parameters into the function (ie: a from date and to date).
    The workbook didn't return any column from any folders, etc. but just presented the calculation that called the function.
    So, in a nutshell, the user runs the first worksheet where 2 parameters are asked for. Then when finished, it means the table is now ready for the real action so they go to the 2nd. worksheet and it just runs without any parameters but refers to the table set up by the first worksheet.
    No parameter passing to the EUL, nothing fancy, but all done in the function that called the pl/sql routine. Very easy.
    So, for you, you should be able to use the same concept, but in batch, run the first worksheet (ie: putting in the 2 parameters), and then just run the 2nd. worksheet once the first is finished and the table setup.
    Hope it helps.
    Russ

  • MDX Query generation

    Dear All,
    Could you please tell me how to find out the MDX query generated at backend when a SAP BW query is executed ?
    Is there a way we can find in SAP system or do we need a third party tool for this ?
    With Regards,
    Pearl

    This depends on the reporting tool that you are using. If you are on BEx Analyzer and your BW backend is based on 7.x then there are no MDX queries generated in backend. Instead of them BICS interface is used.
    For other reporting tools like BEx 3.x you can use transactions RSRT and MDXTEST to test MDX queries.

  • SQL Query generation

    I need to build a query like that:
    SELECT IS_ID
              FROM AP_TABLE
              WHERE ap_type_key LIKE ?
              AND (Here is the problem, I have a array in which I have have one or more values that i need to join with the one or more values in table column. What should be the query here? )

    Ok, Sorry for creating confusion here.
    I have 6 columns in a table that I need to fetch. But with each column, I have say 8 values to match to, a join. I cannot use IN because those 8 values I am comparing with each of 6 column can be (0-8, means 1,2,3 or 0 etc)

  • Query generation basic documentation

    Dear Friends,
    Is there any documentation for query writing.
    Ex.
    How to use inner join , why?
    what is T0 (normally we observed in query)
    Syntax and its use.
    Overall, i want fundamentals of making query.
    Regards,
    MAhesh.

    Hi,
       The document u r looking for might not be available in sap documents but u can better search for sql tutorials.
    As far as u asked about T0 , its nothing else but just a alias name used for the first table used in a query.
    I.E.
       if we want a report using two tables then either we can write
    select ordr.docnum,ordr.docdate,rdr1.itemcode from ordr innerjoin Rdr1 on ordr.docentry= rdr1.docentry
    or else u can replace  ordr with T0 Nd rdr1 with T1
    and the query wud look like
    Select T0.docnum,T0.docdate,T1.itemcode from  ordr T0 innerjoin Rdr1 T1 on  T0.DocEntry = T1.DocEntry .
    and as u asked about the basic syntax
    then a simple query format is
    Select columnname from tablename where 'specify ur conditions'
    Hope this might be helpful to u .
    Thanks
    Abhishek

  • Syntax error on query generation

    Hi,
    When I try to generate report syntax error occures. It's not a custom code. What do you think about it ?
    (syntax error in the following code:
      return.
      perform Debug_xfems.
    See some piece of generated file :
    REPORT RSRRNAME.
    FORM SELECT_4.
      if G_S_QCF-cmess eq rrkg_C_cmess-error.
        perform CU_MESS_send.
      endif.
        read Table <G_THX_s> assigning <G_SX_S>
             with table key k = G_SX_s-k.
        if sy-subrc gt 0.
          insert G_SX_S into table <G_THX_S> assigning <G_SX_S>.
        endif.
    ENDFORM.
      FORM MOVE_Z_SP_0001.
    ENDFORM.
      return.
      perform Debug_xfems.
    form check_fems using value(I_fems) type i.
      perform I_fems of           " REP I_FEMS = 2
              MOVE_Z_SP_0001
              DEBUG_XFems.
    endform.                      " now look at G_TSX_XFems
    Thanks in advance.
    Fiodar.

    Hi,
    I would suggest that you check OSS for existing SAP notes on the issue and if you find nothing, please create a SAP customer message.
    All the best,
    Mike

Maybe you are looking for

  • Re : select-options in abap objects

    Dear friends, I want to give select-options in abap-objects program. How to give that. Thanking You with regards, Mani

  • Application giving error while accessing from WLS standalone 10.3

    Hi All, I am working on jdev 11.1.1.2 My application is running fine using IDE WLS. however i am getting this warning ADFv: Could not find selected item matching value 35 of type: java.lang.String in the list-of-values. the page contains dropdown for

  • File To Mail Scenario Clarification

    Hi! Can someone help me with this.... 1)In a File To Mail Scenario, while selecting the mail server, do we need to select only the mail server or we can select any server...I mean, when I was doing this scenario, I selected my Windows 2003 server....

  • HT201210 First app store behaved weird than total crash! Ipad could not be restored. An unknown error occured (9)

    I upgraded my new Ipad to OS to 6.0.1 today. Right after update visual feedback on app store was simply not there. You press install, it does not give you the "now installing" feedback. Yet you find out that the program is installed after couple of m

  • Charger causes mouse problems

    Hello - I guess this is both two questions and a warning.  I use a 11" MacBook Air  with Mac OS X Lion 10.7.5, purchased in October 2011.  I am in a town in Kenya with no Apple Store.  My charger got fried during some power fluctuations yesterday and