The Query Question.

Hi everyone.
I created a Query button. And the MB's code is:
ApplicationModule am=ADFUtils.getApplicationModuleForDataControl("HrModuleDataControl");
ViewObject vo=am.findViewObject("HrHumanView1");
int tmp=vo.getCurrentRowIndex();
vo.setNamedWhereClauseParam("HumanSort","abc");
vo.executeQuery();
vo.setCurrentRowAtRangeIndex(tmp);
There is 100 records in my database,and the view of HumanSort='abc' have 30 records. If I execture other query operate, for instance,there is 70 records left, next I execture this query operate, the result doen't query from the 70 records,it still query from 100 records.
And on other page, I have a button used the same MB's method. It query from the 70 records.
I don't understand it.
I have already set the task flow 's Data Control Scope to shared.
Help me.Thanks.

I didn't quite understand the problem that you are having, sorry.
First, you can accomplish what your code above is trying to do using declarative features of ADF. The ExecuteWithParams built-in operation assigns values for named bind variables of a view object then re-executes the query.
You need to provide a bit more details about what you mean by "I execute other query operation" (how was this first step achieved? declaratively? using code?) followed by "next I execute this query operation" (assuming you mean the code that sets the bind variable value).
It sounds as if you're expecting the second query to further-filter the results of the first query, but I need to understand better what you did in the first step to let you know if what you're seeing is expected behavior or not.

Similar Messages

  • A question in the query

    Hi,
    i would lke to display 2 rows and 2 columns in the query.
    2 rows: material nr and year
    2 columns: Total amount for whole year and a quarter of this year
    eg.      material nr    year      amount for 2010    amount for 4. quarter 2010
               0000021      2010       50000                        12000
    iput variable is  calenderyear. I think that we could do it.
    but i have a question about row and column.  In my row there is only Calenderyear.  In my columns there are amount for year and this year's quarter. I would like to know if the data for 4. quarter will be displayed , because  row represents calender year und the column repesents 4. quarter 2010?
    Thanks!
    Edited by: gang qin on Jan 15, 2011 1:00 PM

    Hi:
    Your question is a little confusing. Are you wanting to display all 4 quarters. Not just the current quarter?
    If you are already displaying the amount for the year and the current quarter. You can add 3 more restricted key figures restricted by current calendar quarter and then offset those 3 restricted key figures by -1 -2 and -3 respectively to get the 3 prior quarters.
    If you want to display Qrtr 1 Qrtr 2 Qrtr3 and Qrtr 4 and not the past 4 quarters, then you need to have a info object for cal quarter in your info provider and then create 4 restricted key figures - each restricted to Qrtr 1 Qrtr 2 Qrtr 3 and Qrtr 4.
    I am not sure if Calendar Quarter is a standard object available. If not you have to model it.
    Hope this helps.
    MP.

  • Another BW question about filter in the query definition

    Hi ,
    I have another question about filter in the query definition.
    <u>Question:</u>
    Which of the following objects can be filtered in the query definition?
    A. characteristic
    B. Key figure
    C. Structure
    D. Units
    E. Hierarchy
    My answer is A,B,D,E.
    The answer in the book is A,B,D
    Can anybody tell me which one is wrong?
    Thanks in advance,
    Liu Jia

    HI
    1.The answer could be A,B,D.you can not apply filters on hierarchies
    2.Whenever there is a change in Attribute data(like Location,Num etc...)that has to be reflected in all aggregates of the cube.Thsi can be done by running "ATTRIBUTE CHANGE RUN".
    sri

  • Some question about the query designer

    hello, dear all,
    I am a new comer of here, and I am intersting in BI, but I have no basic knowledge about it.
    so I just want someone could give me some advice about it.
    our boss need I do the developer about the query designer,  I just have searched in this forum. but nothing founded for I am a new comer here,
    I heard there are some training document of the query designer, could someone give me the URL, thanks.

    Hi,
    Query desinger is used to develop a Query, Query can be created on following data targets
    -Info Cube
    -DSO
    Virtual data target
    -MultiCube
    -Infoset
    -Multiprovider
    We have 5 section in query designer
    - Infoprovider : where we select the data target , on which report to be created
    -Filter : to restrict value at infoprovider level ( if you want data for year 2008, for example)
    -Free Characterstic : this allow you to drill down
    -Columns : char/keyfigs to be display in columns can be added here
    Row: key/char to be display in Rows can be added here
    gv me ur mailid i will let u have Bex manual,
    I would suggest , if you have any IDES ( training ) system , where you can log in and then go to RRMX,
    and try to create new query and add any data target ( which is already created ) and then drag and drop the char/key fig to the required section ,
    save it and execute it .....
    if you play arround and see the output , that would help u to understand how to work with query designer.
    Hope this helps
    Sukhi
    Edited by: Sukhvidner Singh on Nov 4, 2009 5:36 PM

  • Two questions about the query and lsmw .

    Hi Experts ,
    Could you tell me how to download the query to local driver ? is it possible to do that ?
    I hear somebody introduce lsmw this t-code . it can transfer the data from non-sap/r3 system ? has somebody can fully expain this t-code ?
    Many thanks !!!
    Best Regards,
    Carlos Z

    Hi,
          LSMW – Step by Step Guide: Legacy System Migration Workbench is an R/3 Based tool for data transfer from legacy to R/3 for one time or periodic transfer.
    Basic technique is Import data from Spreadsheet / Sequential file, convert from source format to target format and import into R/3 database. LSMW not part of standard R/3, if we need this product email [email protected]
    Advantages of LSMW:
        • Most of the functions are within R/3, hence platform independence.
       • Quality and data consistency due to standard import techniques.
       • Data mapping and conversion rules are reusable across projects.
       • A variety of technical possibilities of data conversion.
       • Generation of the conversion program on the basis of defined rules
       • Interface for data in spreadsheet format.
       • Creation of data migration objects on the basis of recorded transactions.
       • Charge-free for SAP customers and partners.
    Working With LSMW:
    Use TCODE LSMW
    Objects of LSMW:
      •Project   – ID with max of 10 char to Name the data transfer project.
      • Subproject   – Used as further structuring attribute.
      • Object   – ID with max of 10 Characters, to name the Business object .
      • Project can have multiple sub projects and subprojects can have multiple objects.
      • Project documentation displays any documentation maintained for individual pop ups and processing steps
    User Guide: Clicking on Enter leads to interactive user guide which displays the Project name, sub project name and object to be created.
    Object type and import techniques:
      • Standard Batch / Direct input.
      • Batch Input Recording
          o If no standard programs available
          o To reduce number of target fields.
          o Only for fixed screen sequence.
        • BAPI
        • IDOC
          o Settings and preparations needed for each project
    Preparations for IDOC inbound processing:
        • Choose settings -> IDOC inbound processing in LSMW
        • Set up File port for file transfer, create port using WE21.
        • Additionally set up RFC port for submitting data packages directly to function module IDoc_Inbound_Asynchronous, without creating a file during data conversion.
        • Setup partner type (SAP recommended ‘US’) using WE44.
        • Maintain partner number using WE20.
        • Activate IDOC inbound processing.
        • Verify workflow customizing.
    Steps in creating LSMW Project:
        • Maintain attributes – choose the import method.
        • Maintain source structure/s with or without hierarchical relations. (Header, Detail)
        • Maintain source fields for the source structures. Possible field types – C,N,X, date, amount and packed filed with decimal places.
        • Fields can be maintained individually or in table form or copy from other sources using upload from a text file
        • Maintain relationship between source and target structures.
        • Maintain Field mapping and conversion rules
        • For each Target field the following information is displayed:
          o Field description
          o Assigned source fields (if any)
          o Rule type (fixed value, translation etc.)
          o Coding.
          o Some fields are preset by the system & are marked with Default setting.
        • Maintain Fixed values, translations, user defined routines – Here reusable rules can be processed like assigning fixed values, translation definition etc.
        • Specify Files
          o Legacy data location on PC / application server
          o File for read data ( extension .lsm.read)
          o File for converted data (extension .lsm.conv)
        • Assign Files – to defined source structures
        • Read data – Can process all the data or part of data by specifying from / to transaction numbers.
        • Display read data – To verify the input data being read
        • Convert Data – Data conversion happens here, if data conversion program is not up to date, it gets regenerated automatically.
        • Display converted data – To verify the converted data
    Import Data – Based on the object type selected
        • Standard Batch input or Recording
          o Generate Batch input session
          o Run Batch input session
        • Standard Direct input session
          o Direct input program or direct input transaction is called
    BAPI / IDOC Technique:
        • IDOC creation
          o Information packages from the converted data are stored on R/3 Database.
          o system assigns a number to every IDOC.
          o The file of converted data is deleted.
        • IDOC processing
          o IDOCS created are posted to the corresponding application program.
          o Application program checks data and posts in the application database.
    Finally Transport LSMW Projects:
        • R/3 Transport system
          o Extras ->Create change request
          o Change request can be exported/imported using CTS
        • Export Project
          o Select / Deselect part / entire project & export to another R/3 system
        • Import Project
          o Exported mapping / rules can be imported through PC file
          o Existing Project data gets overwritten
          o Prevent overwriting by using
        ‘Import under different name
        • Presetting for Inbound IDOC processing not transportable.
    Regards

  • Spool file problem,Can't see the query in output file.

    Hello ,
    I am facing a very old school kind of problem .....about spool file ....
    The scenario -
    I have made a script by name DB_Status_checkup.sql which i want to fire on the database to check the database status. In this script their are many queries regarding the data dictionary views to know about the database. It consist of nearly 25-30 different select queries..
    The problem is i want to make a spool file of the output of that query....i want to see the SQL query & the output below in the spool file, so it will be easy for me to judge the result. But i can't see the SQL query , i can only see the output , & in so many queries it all gets jumbled up....even i can't understand where the next output starts ...
    Sample of my SQL Script ....
    clear buffer
    spool D:\DB_status.txt
    /*To check the database startup time*/
    Select to_char(startup_time, 'HH24:MI DD-MON-YY') "Startup time"
    from v$instance
    .........next query n so on....
    spool off;
    In the output pf the spool file at D:\db_status.txt..
    Startup time
    08:25 16-JUL-10It shows only the output of the query in the spool file not the query,
    What should i do to get the SQL query as well as the output of that query just below it in the spool file ???
    Please suggest if you have anymore ideas , regarding this .....
    ORACLE 10g R2
    Windows Server 2008
    Thanks in advance ...

    Why don't you just use database control, instead of re-inventing the wheel?
    Apart from that, SQL*Plus has it's own reference manual, which you apparently refuse to read.
    The answer to your quiz/doc question is
    set echo on
    Sybrand Bakker
    Senior Oracle DBA

  • NOt able to get text value for 0calmonth in the query

    hi,
    I am not able to get the test for the calmonth in the selection screen of the Query.
    i.e If the user enter the value 01/2010 as input in the selection screen. I am not able to get its text Janurary 2010 displayed in the selection screen of the query.
    please let me know what could be the reason for this.
    regards,
    Mahesh

    Hi Mahesh,
    I regret to inform you there is no option to display the month text.
    The system works as designed. The "Key and text" option for the      
    infoObject is for display the technical name and the description.                                                                               
    I found a customer on SDN which the same doubt and the answer for your
    question. Please, check the link below:                                                                               
    0calday text variable        
    Best Regards,
    Des

  • How to modify the query to get the output in a single row

    Hi All,
    Below is the query i have written it works fine
    select DISTINCT right(left(CTACCT,13),4) AS LocationNum,
    tODS_GLBalance.FiscalYearId AS FiscalYearId,
    tODS_GLBalance.FiscalMonthOfYearId AS FiscalMonthOfYearId,
    --tods_GLMetadata.Metric,
    Case when
    tods_GLMetadata.Metric = 'Gross Margin'
    Then SUM(Balance)
    Else 0
    END AS GrossMargin,
    Case when
    tods_GLMetadata.Metric = 'Occupancy'
    Then SUM(Balance)
    Else 0
    END AS Occupancy,
    Case when
    tods_GLMetadata.Metric = 'Payroll Dollars'
    Then SUM(Balance)
    Else 0
    END AS Payroll,
    Case when
    tods_GLMetadata.Metric = 'CF Sales'
    Then SUM(Balance)
    Else 0
    END AS OperatingSales,
    Case when
    tods_GLMetadata.Metric = 'Operations'
    Then SUM(Balance)
    Else 0
    END AS OperatingExpenses
    -- 0 as payroll
    from ods.[JJill].[tODS_GLBalance]
    inner join ods.Staging.tODS_INF_GLPCT ON tODS_GLBalance.PageNum = tODS_INF_GLPCT.CTPAGE
    inner join ods.JJill.tods_GLMetadata ON tods_GLMetadata.AcctDescription = tODS_INF_GLPCT.CTDESC
    where
    (tODS_GLBalance.FiscalYearId = 2012) and
    (tODS_GLBalance.FiscalMonthOfYearId = 2) and
    (right(left(CTACCT,13),4)= 3020)
    group by
    right(left(CTACCT,13),4),
    tODS_GLBalance.FiscalYearId,
    tODS_GLBalance.FiscalMonthOfYearId,
    tods_GLMetadata.Metric
    This is the sample output,
    LocationNum FiscalYearId FiscalMonthOfYearId GrossMargin Occupancy Payroll OperatingSales OperatingExpenses
    3020 2012 2 -112477.00 0.00 0.00 0.00 0.00
    3020 2012 2 0.00 0.00 0.00 -158288.94 0.00
    3020 2012 2 0.00 0.00 0.00 0.00 5625.44
    3020 2012 2 0.00 0.00 24185.79 0.00 0.00
    3020 2012 2 0.00 31075.53 0.00 0.00 0.00
    But, i am expecting the output to be something like this
    LocationNum FiscalYearId FiscalMonthOfYearId GrossMargin Occupancy Payroll OperatingSales OperatingExpenses
    3020 2012 2 -112477.00 31075.53 24185.79 -158288.94 5625.44
    Can someone please help me with changing my query to get the desired output?
    Please let me know if you have any questions.
    Thanks

    Try this:
    SELECT DISTINCT
    RIGHT(LEFT(CTACCT,13),4) AS LocationNum, tODS_GLBalance.FiscalYearId AS FiscalYearId, tODS_GLBalance.FiscalMonthOfYearId AS FiscalMonthOfYearId,
    SUM(CASE WHEN tods_GLMetadata.Metric = 'Gross Margin' THEN Balance ELSE 0 END ) AS GrossMargin,
    SUM(CASE WHEN tods_GLMetadata.Metric = 'Occupancy' THEN Balance ELSE 0 END ) AS Occupancy,
    SUM(CASE WHEN tods_GLMetadata.Metric = 'Payroll Dollars' THEN Balance ELSE 0 END ) AS Payroll,
    SUM(CASE WHEN tods_GLMetadata.Metric = 'CF Sales' THEN Balance ELSE 0 END ) AS OperatingSales,
    SUM(CASE WHEN tods_GLMetadata.Metric = 'Operations' THEN Balance ELSE 0 END ) AS OperatingExpenses
    FROM ods.[JJill].[tODS_GLBalance]
    INNER JOIN ods.Staging.tODS_INF_GLPCT
    ON tODS_GLBalance.PageNum = tODS_INF_GLPCT.CTPAGE
    INNER JOIN ods.JJill.tods_GLMetadata
    ON tods_GLMetadata.AcctDescription = tODS_INF_GLPCT.CTDESC
    WHERE tODS_GLBalance.FiscalYearId = 2012
    AND tODS_GLBalance.FiscalMonthOfYearId = 2
    AND RIGHT(LEFT(CTACCT,13),4) = 3020
    GROUP BY right(left(CTACCT,13),4), tODS_GLBalance.FiscalYearId, tODS_GLBalance.FiscalMonthOfYearId, tods_GLMetadata.Metric

  • Changing the query on a view object

    I have a view object right now, based on an entity. It is the default view object, so that means the query in the view object is straight forward, it grabs all of the attributes from the table. And there is no WHERE clause.
    In reality I only want to show a finite set of rows from my table. Every time a record is changed/edited in this entity and committed, a new row in the database is created with the same information (I'm using CreateWithParams) except for a few columns.
    I actually don't really have update on this table, just creation of new rows. But to the user, I want it to 'look' like they are editing something in the table.
    Example:
    12, 11:32,Thompson, 60 (the user edits this information in an adf table, and a new row is created in the db)
    12, 11:55, Thompson, 75
    I have a timestamp (see above) field in the database that is used as part of my primary key, so that I know which record is the latest.
    When the VO query is run, I want the user to only see the latest row from the db.
    12, 11:55, Thompson, 75
    So...
    I went to my VO, and I changed the WHERE query to add this:
    where t1.TimeStamp = (Select MAX(t2.TimeStamp) FROM rcl.x t2 where t1.uid = t2.uid);
    Now, this isn't a mysql/sql question. There's actually a better query that I'd rather run, but the VO editor doesn't allow me to change the query itself....
    When I save the new WHERE to my VO, run my page again, I get the expected result (showing me only the latest records).
    However, when I try and sort on the table in which my data is displayed, I am now getting ORDER BY errors.
    I don't want my VO to be read-only sql based. I want to be able to update my table, so I have my VO running off of the entity.
    Why doesn't the VO allow me to change the query itself? (Like do a subquery, instead of having my where clause do the work)
    Why are order by errors being thrown when I sort on my adf table after changing the where clause in my view?
    Hopefully I wasn't too convoluted in the explanation of my problem..
    Thanks in advance,
    Joel

    HI Joe,
    Regarding your problem you can do one of the following tasks:
    1- easily to tuning on your view object, I mean in the tuning page of the view you can set that only return 1 record or 2-3 record fetch not all the record.
    in the order by you will order by the timestamp field and descending.
    2- you can order by the timestamp descending and in the where clause only set the rownum<2 (will return the last record) you can also set rownum<5 and get the 4 last record etc.
    3-editing the view query in the expert mode is not advised at all because of many consequences that you will face.
    4- maybe it is not bat that you add a readonly view for the table you mentioned and every time you unpdate the entity just re-execute the read-only view.( this method maybe is good maybe is not it depends on your business logic)
    Regards.
    Edited by: Amir Khanof on Sep 3, 2010 11:11 PM

  • How to manage Locale info in the URL path, but not the query string

    We are building an application using Struts 1.1 and Tiles, on Oracle Application Server 10.1.3.3...
    I know this is a strange question... but we have a requirement to represent the locale info in the URL string using one of the following options:
    option 1: /eng/page.do?id=2 for english.../fra/page.do?id=2
    option 2: /page-eng.do?id=2 for english.... and /page-fra.do?id=2 for french
    We need to represent the 3 letter ISO lang code either in the directory structure, or suffix the page name (in our case, the struts action name)... we cannot replicate this using a parameter in the query string. I know this is odd, but that is what we are told to implement.
    Is there any robust way of implementing either option in Struts 1.1, JSP, JSTL etc...?
    Currently, we are looking at using a servlet filter to intercept the HTTP requests, parse the URL string, and extract the ISO lang value, and set locale and forward on the request.
    This poses a few problems... adding additional action mappings (page-eng... page-fra... page) to our struts-xml.config file to handle lang permuations... but the biggest issue is all the embedded html:link action values throughout our code...
    Because all our public facing URLs must comply with the rule, we need to change the html:link action to point to a different action, based on locale.
    Very inefficent, and I'm sure not industry standard best practice... we are using Tiles, and resource bundles for all our labels etc... but fall short in meeting this rule with regards to URLs and locale.
    Any advice or tips etc.. is greatly appreciated.

    The filter option sounds like a good solution. So it can receive the urls and parse them appropriately.
    You just need to take it one step further.
    Additional actionmappings in your struts-config should not be necessary.
    Filter:
    - analyses the url and sets the appropriate locale
    - adjusts the url such that the next level of the chain does not have to know anything about the locale being encoded in the url string.
    Thus your struts classes and mappings can remain unchanged
    /eng/page.do or /fra/page.do once through the filter should just look like /page.do to struts.
    That should get rid of half of your headache.
    Next the issue of generating urls.
    There are two approaches I can see here
    1 - use the filter approach again, this time with some post processing. Gather the generated HTML in a buffer, and do a find/replace on any urls generated, to put the locale encoding into them.
    2 - Customise struts to produce urls in this format. This would involve the html:link tag, and the html:form tag at the least (maybe others?). Get the source code for struts, and grab the html:link tag code. Extend that class to generate urls as you want them to be generated. I think you would need to extend the class org.apache.struts.taglib.html.LinkTag and override the protected method calculateURL. You would then have to edit/modify the struts-html tld to point the link tag at your classes rather than the standard ones.
    Option 1 is architecturally good because it gives you a well defined layer/border between having the locale encoded in the url, and not having it there. However it involves doing a find/replace on every html going out. This would catch all urls, whether generated by html:link tag or not.
    Option 2 requires customising struts for your own requirements, which may be a bit daunting, but has the advantage of generating the urls correctly without the extra overhead involved with option 1. Of course you would have to ensure that ALL urls are generated with the html:link tag.
    On reflection, I think option 1 is preferable, as both easier and quicker to implement, and doing a better separation in the architecture.
    Cheers,
    evnafets

  • Result of the query is not filtered as value given in Select Option variabl

    Hello ,
    A Select option Variable is created on Navigational Attribute( ZINV_PROG) of 0WBS_ELEMT.
    The Compound Key for object ZINV_PROG(Investment program) is APPR_YEAR( Approval Year)
    This ZINV_PROG object does not bear Master data.
    The values in the field get populated as you load Master data of 0WBS_ELEMT.
    The values for this objects is as shown below:
    APPR_YEAR ZINVPROG
    2005 ESCCCAPS
    2007 ESCCCAPS
    2008 FIRE
    2006 CAPITAL
    A select option variable is craeted on this Navigational attribute.
    When you execute the query , On the selection screen of the query..
    If you provide i/p for Investment programm field as 2007 ESCCCAPS, the data should ideally be filtered for this values only.
    But the result of the query shows data for both values 2005 ESCCCAPS and as well as for 2007ESCCCAPS.
    Let me know how to sort this issue.
    Points will be assigned for the correct and helpfull answere.
    Thanks,

    Thanks Srini for your prompt explanation.
    My Question is if Approval year is a compounded key of ZINV_PROG object why data would not get filter out directly.
    I mean on the screen for this particualr variable i take help - F4 to see values there you are able to see all the values of Investment programm along with the apprroval year.
    If i select value as 2005 ESCCCAPS from the help F4 screen then ideally data should be fileterd out for this particular value. But it is not happening so.
    Is that so in Query desgining that if you creating a variable on Nav Attribute, and that particular Nav attribute has a compound key then if you want to filter out the data for this Nav attribute correctly you would also require to create a variable for Compound key also.
    Please let me know
    Thanks

  • Help in generating the query

    Hi All,
    I have the below requirement.
    Master table:
    Product ID      Product Name
    1               TV
    2               Cellphone
    3               Laptop
    4               DVD Player
    Details table:
    Product ID     Spec type     Spec Detail
    1               Color          Blue
    1               Weight          20
    2               Color          Blue
    2               Weight          20
    3               Color          Blue
    3                Weight          25
    4               Color          Blue
    4               Weight          20
    4               Height          10Im looking for a way to identify the products that has exact same specifications.
    ie., in the above example TV and Cellphone has the exact specifications.
    So the output of the query should be TV and Cellphone here.
    Is it possible to do in a query or we need to have some sql block to perform this action.
    Any help would be greatly appreciated.
    Thanks,
    Agathya

    Hi agathya,
    We don't know how you would like to handle the situation where more than two products have the same specifications, so I extended your sample data a bit to reflect that situation as well:
    SQL> create table products (id,name)
      2  as
      3  select 1, 'TV' from dual union all
      4  select 2, 'Cellphone' from dual union all
      5  select 3, 'Laptop' from dual union all
      6  select 4, 'DVD Player' from dual union all
      7  select 5, 'Radio' from dual union all
      8  select 6, 'VCR' from dual
      9  /
    Tabel is aangemaakt.
    SQL> create table product_specifications (product_id,spec_type,spec_detail)
      2  as
      3  select 1, 'Color' , 'Blue' from dual union all
      4  select 1, 'Weight', '20'   from dual union all
      5  select 2, 'Color' , 'Blue' from dual union all
      6  select 2, 'Weight', '20'   from dual union all
      7  select 3, 'Color' , 'Blue' from dual union all
      8  select 3, 'Weight', '25'   from dual union all
      9  select 4, 'Color' , 'Blue' from dual union all
    10  select 4, 'Weight', '20'   from dual union all
    11  select 4, 'Height', '10'   from dual union all
    12  select 5, 'Color' , 'Blue' from dual union all
    13  select 5, 'Weight', '20'   from dual union all
    14  select 6, 'Color' , 'Blue' from dual union all
    15  select 6, 'Weight', '20'   from dual union all
    16  select 6, 'Height', '10'   from dual
    17  /
    Tabel is aangemaakt.
    SQL> select p1.name
      2       , p2.name
      3    from products p1
      4       , products p2
      5       , product_specifications ps1
      6       , product_specifications ps2
      7   where p1.id = ps1.product_id
      8     and p2.id = ps2.product_id
      9     and p1.id < p2.id
    10   group by p1.id
    11       , p1.name
    12       , p2.id
    13       , p2.name
    14  having sqrt(count(*)) =
    15         count(case when ps1.spec_type = ps2.spec_type and ps1.spec_detail = ps2.spec_detail then 1 end)
    16  /
    NAME       NAME
    TV         Cellphone
    TV         Radio
    Cellphone  Radio
    DVD Player VCR
    4 rijen zijn geselecteerd.But why on earth did you or your predecessor model product specifications like this? You are making it far more complicated than it needs to be. And the datatype of height and weight should not be the same as for color. But now they are. And how do you restrict the allowable values for colors? Color, weight and height are attributes of your products so they should have been modeled like that.
    See how easy your questions becomes after remodeling it:
    SQL> drop table product_specifications purge
      2  /
    Tabel is verwijderd.
    SQL> drop table products purge
      2  /
    Tabel is verwijderd.
    SQL> create table products (id,name,color,weight,height)
      2  as
      3  select 1, 'TV', 'Blue', 20, null from dual union all
      4  select 2, 'Cellphone', 'Blue', 20, null from dual union all
      5  select 3, 'Laptop', 'Blue', 25, null from dual union all
      6  select 4, 'DVD Player', 'Blue', 20, 10 from dual union all
      7  select 5, 'Radio', 'Blue', 20, null from dual union all
      8  select 6, 'VCR', 'Blue', 20, 10 from dual
      9  /
    Tabel is aangemaakt.
    SQL> select * from products
      2  /
            ID NAME       COLO     WEIGHT     HEIGHT
             1 TV         Blue         20
             2 Cellphone  Blue         20
             3 Laptop     Blue         25
             4 DVD Player Blue         20         10
             5 Radio      Blue         20
             6 VCR        Blue         20         10
    6 rijen zijn geselecteerd.
    SQL> select p1.name
      2       , p2.name
      3    from products p1
      4       , products p2
      5   where p1.id < p2.id
      6     and ( p1.color = p2.color or (p1.color is null and p2.color is null))
      7     and ( p1.weight = p2.weight or (p1.weight is null and p2.weight is null))
      8     and ( p1.height = p2.height or (p1.height is null and p2.height is null))
      9  /
    NAME       NAME
    TV         Cellphone
    TV         Radio
    Cellphone  Radio
    DVD Player VCR
    4 rijen zijn geselecteerd.Hope this helps.
    Regards,
    Rob.

  • The structure in the query

    HI,BW experts, I have a question about the structure of the query :is there only one key figure in the query?in my query ,i have a key figure structure already, could I create another key figure structure,and how to ?
    Thanks for your help.

    Hi Cindy
    If your query already has a structure then why you want to create a new one? add new key figures to the exisiting structure.
    If you have to create new structure for key figures then
    GO to Query change in Query designer & in Columns section do right mouse click and select structure. This will add new structure and then you can add new key figures to that if you need.
    Hope this helps
    Regards
    Pradip

  • SSMS 2012:XQuery-doing "Retriving Job Candidates with the query Method" in AdventuresWorks 2012. Unclosed quotation mark after string '//*:Name.First?

    Hi all,
    From Page 354 of the the Book "Pro T-SQL 2008 Programmer's Guide" written by Michael Coles (published by apress), I copied the following code (Listing 12-9 Retrieving Job Candidates with the query Method):
    --Coles12_9.sql // saved in C:/Documemnts/SQL Server Management Studio
    -- Coles Listing 12-9 Retrieving Job Candidates with the query Method
    -- Doing XQuery and the xml Data Type in AdvantureWorks
    -- 17 March 2015 1105 AM
    USE AdventureWorks;
    GO
    SELECT Resume.query
    N'//*:Name.First,
    //*:Name.Middle,
    //*:Name.Last,
    //*:Edu.Level
    FROM HumanResources.JobCandidate;
    I executed this set of Listing 12-9 code in my SQL Server 2012 Management Studio and I got the following error messages:
    Msg 105, Level 15, State 1, Line 4
    Unclosed quotation mark after the character string '//*:Name.First,
    //*:Name.Middle,
    //*:Name.Last,
    //*:Edu.Level
    FROM HumanResources.JobCandidate;
    Msg 102, Level 15, State 1, Line 4
    Incorrect syntax near '//*:Name.First,
    //*:Name.Middle,
    //*:Name.Last,
    //*:Edu.Level
    FROM HumanResources.JobCandidate;
    I am not able to figure out why I got the error messages.  Please kindly help and advise me how to correct this set of sql codes.
    Thanks in advance,
    Scott Chang

    Hi Scott,
    I don't have that book at hand, but your problem is the "Unclosed quotationmark after the character string",as the error message shows. You have to enclose the 'XQUERY' string quotation in the
    query().
    SELECT jobcandidateid, Resume.query
    N'//*:resume,
    //*:Name.Middle,
    //*:Name.Last,
    //*:Edu.Level' --enclose the quotation here
    FROM HumanResources.JobCandidate;
    For XQUERY learning, here is a good
    link.
    If you have any question, feel free to let me know.
    Eric Zhang
    TechNet Community Support

  • "None of the fact tables are compatible with the query request"

    Hi guys,
    I have a weird issue. Previously fine working Subject area started to give this error after migration. The issue is happening when I select a column from dimension and try to display it. Also, I can't get to the list of values in filter I get "Error retrieving choices" error. One dimension is working fine though, and when a column from it is selected, it displays other column just fine. I checked physical layer, primary keys, mappings in the BMM, LTS sources, Connection Pool settings. Everything looks legit. For few hours it was working fine, and now it's giving this issue. Anyone knows what the cause could be. The search I've conducted revealed that this is a data mapping issue - however, all my layers seem to be in check. Thanks

    hi user582149,
    It is difficult to answer you question with such a little amount of details. Could you specify:
    - how many facts/dimensions are you using in the query?
    - what is the structure of your Business Model?
    - which version of OBI are you using?
    - what does your log say?
    I hope to tell you more having the information above
    Cheers

Maybe you are looking for

  • How do I find the name of the server?

    Hi all, I've finished a server program that returns a hard-coded html page via a socket but was hoping to make it as authentic as possible. Therefore is there a way of retrieving the server's name that I'm conecting to without using servlets? My code

  • When i try to log in to icloud on my windows 7 it says 'you cant sign in because of a server error'

    When i try to log in to icloud on my windows 7 it says 'you cant sign in because of a server error'

  • Designing column wise report

    Hi, I am newbie in Crystal report. I stuck into a design problem of crystal report. I would like to design a report as per the desired-report.png (attached). My dataset is like report2.xml and relationship specified in relationship-diagram.png (attac

  • Mavericks Kernel Panic reboots

    I'm having severals kernel panics after upgrading to OSX 10.9 Mavericks. I searched the solution since the upgrade. I read in the forums plenty solutions, but none worked for me. The computer says this: Anonymous UUID:       CBBDA021-9982-E96A-647D-F

  • How to start Weblogic 10.3.5 managed server on port 80

    Hello, We're trying to understand how to start Weblogic as root so we can start on port 80 on Linux. We understand that we'll use the post bind UID to run as a non-priv user. Right now in the Admin console under the managed server, Server Start prope