Database ranking

Gentlemen,
the most recent BO documentation mentions the feature "database ranking" and lists some relational database management systems supporting this feature. I want to avoid ranking the WebI report itself but have the database do this job.
Is database ranking also possible when working with SAP BW based OLAP universes (sitting on BEx Queries) in BO XI 3.1 SP2?
Thank you.
Regards
Johannes

Hi,
Unfortunately its is not posssible to do a ranking on the Web Intelligence query panel usin SAP BW OLAP Universes: this should normally be addressed in Aurora.
By the way there are 2 alternatives:
<li>Use Data Federator for accessing SAP BW in relational mode and take advantage of relational ranking features
<li>Use OLAP universe and defined a calauclated measures that rank the members of a given characteristic/hierarchy for a given key figures then define a predefined filter to filter the calculated expression in order to have the Top N or the Bottom N.
Here is a sample that rank Company Code over Open order quantity
<EXPRESSION>Rank([0D_CO_CODE].CurrentMember, Order( [0D_CO_CODE].CurrentMember.Level.Members ,
@Select(Open order quantity in base unit (SAP DEMO)\Open order quantity in base unit (SAP DEMO)))</EXPRESSION>
Now here is the same example used in a predefined filter:
<FILTER EXPRESSION="Rank([0D_CO_CODE].CurrentMember, Order( [0D_CO_CODE].CurrentMember.Level.Members ,
@Select(Open order quantity in base unit (SAP DEMO)\Open order quantity in base unit (SAP DEMO)))"><CONDITION OPERATORCONDITION="GreaterOrEqual">
<CONSTANT CAPTION="Value"></CONSTANT>@Prompt('Enter value for Top n','N',,mono,free)</CONDITION></FILTER>
Regards,
Didier

Similar Messages

  • WEBI Database ranking problem

    Hi,
    I have a problem with Add Database ranking feature in query filter in WEBI rich client.
    I have 100 products and would like to pull only top 10 products onto my report based on number of sales (measure). I am using SQL server 2008. But when I use this feature I am only getting a table with only top 4 products in my report. When I increase the number to sat 50 or 60 (top 50 products in my query) I am getting top 10 now.
    Is it a bug which can be fixed with any fix pack. Like I get only top 4 products if I choose top 10 in the ADD database ranking and I get 10 if I use any number greater than 63 in the query.
    Eg:
    Case1: Query: Database ranking : Top 10; Product (Dimension); based on Sales(measure)\
    Result: Table with only top 4 products sorted in descending order instead of 10 products
    Case2: Query: Database ranking : Top 63; Product (Dimension); based on Sales(measure)\
    Result: Table with only top 10 products sorted in descending order.
    Right now it meets my criteria of getting top 10 products when I use top 63 in the query, but I think there is something wrong with this work around. Please reply me with any solution.
    Thanks
    Sudhir.

    Initially I used an example of Product and Sales to explain, which are in reality SCREEN.NAME and AGG_SCREEN.ACTIVE_TIME_SUM respectively as shown below.
    SELECT
      sum (REP.dbo.AGG_SCREEN.ACTIVE_TIME_SUM),
    REP.dbo.SCREEN.NAME
    FROM
      REP.dbo.AGG_SCREEN INNER JOIN REP.dbo.SCREEN ON (REP.dbo.AGG_SCREEN.SCREEN_ID=REP.dbo.SCREEN.ID)
    WHERE
    REP.dbo.SCREEN.NAME  IN 
         SELECT
           View__1.Column__1
         FROM
         SELECT
           REP.dbo.SCREEN.NAME AS Column__1,
           RANK() OVER( ORDER BY REP.dbo.AGG_SCREEN.ACTIVE_TIME_SUM DESC  ) AS Rk__1
         FROM
          REP.dbo.AGG_SCREEN INNER JOIN REP.dbo.SCREEN ON (REP.dbo.AGG_SCREEN.SCREEN_ID=REP.dbo.SCREEN.ID)
         )  View__1
         WHERE  View__1.Rk__1  <=  10
    group by REP.dbo.SCREEN.NAME
    Note: text in bold represent changes I made to SQL generated to sum and group by when used against database.

  • Database ranking not working properly

    Hi,
    I am using BO XI 3.1. I have a requirement where I need to show top X Customers depending on their balance.
    I have applied Db ranking in query panal and try to run the report. However, I am getting wrong and very irrelivent values.
    I checked it by applying report level ranking in separate report and it worked fine. I also checked if object are declared properly and there is no issue with that.
    Please help me understand my problem here.

    Hi,
    Just one observation on the select you posted, you do realize the two dates are different columns in the table;
    JayeshD wrote:
    >        ( Tab1.TRANS_DATE = '28/02/2009'  )
    >    ( BI_BO_CROSS_SELL.POST_DATE = '28/02/2009'  )
    The top 10 customers will be determined based on the total balance amount in the transactions with a trans_date of  '28/02/2009'
    Whereas what the main query pulls back is the total balance amount of the transations with post_date of  '28/02/2009' for that top 10 of customers.
    So the amount you pull back in your query is not the amount on which the top 10 was based.
    Hope this helps,
    Marianne
    Also, I'm missing a sum arount the a balance amount, so the amount will be summed in the report, not by the database.
    This is something I would take up with the universe designer...

  • Is rank() really better than rownum for top-n-queries?

    Several sources say that for Oracle databases rank() should be used instead of 'rownum <= n' for top-n-queries. But here we have an application, where we a lot of top-n queries are executed on a big table with several million rows and rank() has a quite bad performance. I get much better results when I use a query with rownum <= n but the programmer of the application doesn't want to change it in the software because of those articles about rank() and rownum. I wonder, whether it is possible, to find a better form of the rank()-query or an additional index, that gives me the same performance.
    To explain my case I created the following example (if you try it, be aware that depending on the size of your dba_objects view you might need up to half a gig free space in your tablespace for this example).
    create table big_objects
    as
    select
    ascii(m.alpha)*100000+o.object_id object_id,
    o.owner owner,
    o.object_type,
    m.alpha||'_'||o.object_name object_name,
    sysdate-400+mod(100*object_id+99*ascii(m.alpha),365)+24/(o.object_id+ascii(m.alpha)) created,
    o.status
    from
    (select distinct
    upper(substr(object_name,1,1)) alpha
    from
    sys.dba_objects
    where
    upper(substr(object_name,1,1)) between 'A' and 'Z') m,
    sys.dba_objects o
    order by
    object_name;
    create index bigindex_1 on big_objects (owner, object_type, created);
    analyze table big_objects compute statistics;
    So my table looks a bit like dba_objects but with much more rows and I made a synthetic "created" date which is more similar to my real case, where top-n means a date selection of the newest records from a certain type.
    Here is the size of the segments on an nearly empty 11gR2 database:
    select segment_name, bytes, blocks from sys.dba_segments where segment_name like 'BIG%'
    SEGMENT_NAME BYTES BLOCKS
    BIGINDEX_1 75497472 9216
    BIG_OBJECTS 142606336 17408
    On my database the example table has approx. 1,9 Mio rows:
    select count(*) from big_objects;
    COUNT(*)
    1884246
    and some 1,4% of those rows have owner = 'SYS' and object_type = 'INDEX'
    select
    count(*)
    from big_objects
    where owner = 'SYS'
    and object_type = 'INDEX';
    COUNT(*)
    25896
    But I want to find only the 10 newest indexes for the owner SYS. I think the typical rank() approach would be:
    select
    owner,
    object_type,
    object_name,
    object_id,
    status,
    created
    from
    ( select
    owner,
    object_type,
    object_name,
    object_id,
    status,
    created,
    rank() over (order by created desc) rnk
    from
    big_objects
    where
    owner = 'SYS'
    and object_type = 'INDEX')
    where rnk <= 10
    order by created asc;
    OWNER OBJECT_TYPE OBJECT_NAME OBJECT_ID STATUS CREATED
    SYS INDEX B_COLLELEMIND 6600515 VALID 15.04.2010 19:05:55
    SYS INDEX V_I_WRI$_OPTSTAT_IND_OBJ#_ST 8600466 VALID 15.04.2010 19:09:03
    SYS INDEX G_I_RLS 7100375 VALID 15.04.2010 19:23:55
    SYS INDEX V_I_DIR$SERVICE_UI 8600320 VALID 15.04.2010 19:31:33
    SYS INDEX L_I_TSM_DST2$ 7600308 VALID 15.04.2010 19:36:26
    SYS INDEX L_I_IDL_UB11 7600235 VALID 15.04.2010 19:57:34
    SYS INDEX V_I_VIEWTRCOL1 8600174 VALID 15.04.2010 20:19:21
    SYS INDEX L_I_TRIGGER2 7600162 VALID 15.04.2010 20:31:39
    SYS INDEX L_I_NTAB1 7600089 VALID 15.04.2010 21:35:53
    SYS INDEX B_I_SYN1 6600077 VALID 15.04.2010 22:08:07
    10 rows selected.
    Elapsed: 00:00:00.22
    Execution Plan
    Plan hash value: 2911012437
    | Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
    | 0 | SELECT STATEMENT | | 1427 | 188K| 1400 (1)| 00:00:17 |
    | 1 | SORT ORDER BY | | 1427 | 188K| 1400 (1)| 00:00:17 |
    |* 2 | VIEW | | 1427 | 188K| 1399 (1)| 00:00:17 |
    |* 3 | WINDOW SORT PUSHED RANK | | 1427 | 79912 | 1399 (1)| 00:00:17 |
    | 4 | TABLE ACCESS BY INDEX ROWID| BIG_OBJECTS | 1427 | 79912 | 1398 (0)| 00:00:17 |
    |* 5 | INDEX RANGE SCAN | BIGINDEX_1 | 1427 | | 9 (0)| 00:00:01 |
    Predicate Information (identified by operation id):
    2 - filter("RNK"<=10)
    3 - filter(RANK() OVER ( ORDER BY INTERNAL_FUNCTION("CREATED") DESC )<=10)
    5 - access("OWNER"='SYS' AND "OBJECT_TYPE"='INDEX')
    Statistics
    1 recursive calls
    0 db block gets
    25870 consistent gets
    0 physical reads
    0 redo size
    1281 bytes sent via SQL*Net to client
    524 bytes received via SQL*Net from client
    2 SQL*Net roundtrips to/from client
    2 sorts (memory)
    0 sorts (disk)
    10 rows processed
    As from the index only the first two columns are used, all the 25896 records that I found above are read and sorted just to find the ten newest ones. Many unnecessary blocks are read and luckily all needed database blocks were in memory already. In our real case quite often a lot of physical reads are performed, which makes the performance of the application even worse.
    In my following example with a "rownum <= 10" all three columns of the index are used and the number of block gets is much, much smaller than in the rank() example.
    select
    owner,
    object_type,
    object_name,
    object_id,
    status,
    created
    from
    big_objects
    where
    (owner, object_type, created)
    in
    ( select
    owner,
    object_type,
    created
    from
    ( select /*+ first_rows(10) */
    owner,
    object_type,
    created
    from
    big_objects
    where
    owner = 'SYS'
    and object_type = 'INDEX'
    order by
    owner,
    object_type,
    created desc
    where rownum <= 10
    order by created asc;
    OWNER OBJECT_TYPE OBJECT_NAME OBJECT_ID STATUS CREATED
    SYS INDEX B_COLLELEMIND 6600515 VALID 15.04.2010 19:05:55
    SYS INDEX V_I_WRI$_OPTSTAT_IND_OBJ#_ST 8600466 VALID 15.04.2010 19:09:03
    SYS INDEX G_I_RLS 7100375 VALID 15.04.2010 19:23:55
    SYS INDEX V_I_DIR$SERVICE_UI 8600320 VALID 15.04.2010 19:31:33
    SYS INDEX L_I_TSM_DST2$ 7600308 VALID 15.04.2010 19:36:26
    SYS INDEX L_I_IDL_UB11 7600235 VALID 15.04.2010 19:57:34
    SYS INDEX V_I_VIEWTRCOL1 8600174 VALID 15.04.2010 20:19:21
    SYS INDEX L_I_TRIGGER2 7600162 VALID 15.04.2010 20:31:39
    SYS INDEX L_I_NTAB1 7600089 VALID 15.04.2010 21:35:53
    SYS INDEX B_I_SYN1 6600077 VALID 15.04.2010 22:08:07
    10 rows selected.
    Elapsed: 00:00:00.03
    Execution Plan
    Plan hash value: 3360237620
    | Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
    | 0 | SELECT STATEMENT | | 10 | 760 | 17 (0)| 00:00:01 |
    | 1 | SORT ORDER BY | | 10 | 760 | 17 (0)| 00:00:01 |
    | 2 | NESTED LOOPS | | | | | |
    | 3 | NESTED LOOPS | | 10 | 760 | 17 (0)| 00:00:01 |
    | 4 | VIEW | VW_NSO_1 | 10 | 200 | 2 (50)| 00:00:01 |
    | 5 | HASH UNIQUE | | 10 | 200 | 4 (25)| 00:00:01 |
    |* 6 | COUNT STOPKEY | | | | | |
    | 7 | VIEW | | 11 | 220 | 3 (0)| 00:00:01 |
    |* 8 | INDEX RANGE SCAN DESCENDING| BIGINDEX_1 | 1427 | 28540 | 3 (0)| 00:00:01 |
    |* 9 | INDEX RANGE SCAN | BIGINDEX_1 | 3 | | 2 (0)| 00:00:01 |
    | 10 | TABLE ACCESS BY INDEX ROWID | BIG_OBJECTS | 3 | 168 | 6 (0)| 00:00:01 |
    Predicate Information (identified by operation id):
    6 - filter(ROWNUM<=10)
    8 - access("OWNER"='SYS' AND "OBJECT_TYPE"='INDEX')
    9 - access("OWNER"="OWNER" AND "OBJECT_TYPE"="OBJECT_TYPE" AND "CREATED"="CREATED")
    Statistics
    1 recursive calls
    0 db block gets
    26 consistent gets
    0 physical reads
    0 redo size
    1281 bytes sent via SQL*Net to client
    524 bytes received via SQL*Net from client
    2 SQL*Net roundtrips to/from client
    1 sorts (memory)
    0 sorts (disk)
    10 rows processed
    I made this comparison with the Oracle versions 10.2 and 11.2 and the result was more or less the same. How can I change the rank() query in a way that only the small number of really needed blocks are read from the database?

    this was exactly the hint, I was looking for. Generally speaking hints are not the preferred way to go to tune queries. They can have nasty side-effects when data changes.
    Now the rank()-query is similar fast and much better to read than my fast one with three nested SELECTs.
    Your rownum query was needlessly complicated, and could be simplified to:
    select owner, object_type, object_name, object_id, status, created
    from (select owner, object_type, created
          from big_objects
          where owner = 'SYS' and
                object_type = 'INDEX'
          order by created desc)
    where rownum <= 10
    order by created ascand very likely get the same speed.
    One more question. How did you format those sql queries and results. When I copy/paste them into the editor of forums.oracle.com the format allways gets lost.To preserve formatting use {noformat}{noformat} before and after the section you want ot keep formatted.  In general, if you want to see how someone generated an effect, reply to the post and hit the quote original icon.  You will see all the formatting codes used in the original.
    John                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • Rank in QaaWS not working correctly?

    Hi,
    I am trying to integrate a simple Top 10 customers query in XCelsius using QaaWS:
    I've  built a simple universe on MS AdventureWorksDW Sample Database.
    Using this universe, I've built a QaaWS using dimension Name, measure Sales amount (sorting on Sales amount).
    I added an Rank filter to show top 10 Name based on Sales amount.
    Until now everything ok.
    Since I want a year filtering in XCelsius, I added a CalendarYear Inlist filtering using prompt.
    Now, everytime I use a subset of complete year range (say, only one year), results are not correct. It seems that not all rows are evaluated correctly (compared with WebI, Names are missing).
    If I use only year filter, results are correct, but then a lot of rows are transmitted to XCelsius and decrease performance.
    The issue is not an XCelsius one, since I see the problem already in Query as a Web Service  preview.
    I am using Query as a Web Service 12.1.2000.882.
    Does anybody know about this issue and maybe how to resolve? If not, what would be a good approach to debug? I would like to see QaaWS generated SQL.
    Regards,
    Stefan

    Hello David,
    I use an OLE DB connection to a MS SQL Server 2005.
    Connection Details say:
    Version 2.0.0.29
    Build 12.1.0.882
    Network Layer OLE DB
    DBMS Engine MS SQL Server 2205
    Database used is MS AdventureWorksDW sample database (data warehouse sample)
    I noticed that only with this database, ranking is selectable (not with the AdventureWorks non-DW sample database).
    Ranking itself seems to work, if I activated ranking (e.g. Top 10 customers) everything is ok.
    (Also if I  send a direct SQL command with ranking to the DBMS, it seems ok.)
    Issue arise if I add year filter. Combination of rank and year filter does not seem to work properly.
    Any idea why? Or do you wanted to say that this issue might also be related to DBMS support? I would hope / expect to get a straight "ranking not supoorted" and not incorrect data back ...
    Thanks for your answer anyway!
    Regards,
    Stefan

  • Using Ranking on MS SQL Server 2005

    Hello,
    We are on BOXI3.1 base version and have a universe on top of MS SQL Server 2005.
    My question is regarding use of rank functions. BO guides state that
    You can perform a database ranking only if your database supports
    it. If this is not the case, the Add a database ranking button is disabled on
    the Query Panel toolbar. Databases that support ranking are Oracle, DB2,
    Terradata and Redbrick.
    So SQL Server is not in the list. However the add database ranking button is enabled on
    my report panel. If i add a ranking the query runs for a long time and times-out.
    Is there any universe parameter i need to enable to use ranking? Has any-one mangaged to
    use ranking functionality with SQL Server 2005.
    Thanks in advance.

    Hi Bashir Awan,
    When we create this Object (using your example) at Universe level is the ranking hardcoded ?
    My questions is, say i have Product object (with values A, B, C, D, E), and sales aggregated (10, 20, 30, 40, 50, 60, 70, 80, 90, 100)
    Say the table is as follows
    Product;        sales
        A;               10
        A;                70*
        B;                 50
        B;                 20*
        C;                 30
        C;                 60*
        D;                 40
        D;                 90
        E;                 80
        E;                100
    Note: * represents Oversees sales outside US
    Case 1: Now when we rank whole data to select top 3 we should get (E, D, C in Desc order)
    Case 2: Now if I apply prompt on Country of sales as US will I get (E, B, D) or is it still (E, D, C as earlier).
    Case 3: Similarly if I apply prompt on Product (no prompt on Country) in the filter pane and select (A, D, E) will my results show (E, D, A) or (E, D) as the value of A may be restricted due to ranking formula based on sales at Universe level.
    I am sorry I may be asking a very basic question. Thanks
    Sudhir.

  • Filter Between in QAAWS not working correctly for period, how to resolve?

    I created universe based on query on bw and then created query in QaaWs.
    I trying to query summary of sale amount for the periods that selected on the prompts screen.
    I put sale amount in Result Ojbects pane and put periods in Filter Objects pane.
    And set periods option to prompts in between. When I entry periods 008.2009 - 009.2009
    The result of sale amount is not correct. It's seem only show the value of one period.
    Does anybody know about this issue and maybe how to resolve?
    Thanks.

    Hello David,
    I use an OLE DB connection to a MS SQL Server 2005.
    Connection Details say:
    Version 2.0.0.29
    Build 12.1.0.882
    Network Layer OLE DB
    DBMS Engine MS SQL Server 2205
    Database used is MS AdventureWorksDW sample database (data warehouse sample)
    I noticed that only with this database, ranking is selectable (not with the AdventureWorks non-DW sample database).
    Ranking itself seems to work, if I activated ranking (e.g. Top 10 customers) everything is ok.
    (Also if I  send a direct SQL command with ranking to the DBMS, it seems ok.)
    Issue arise if I add year filter. Combination of rank and year filter does not seem to work properly.
    Any idea why? Or do you wanted to say that this issue might also be related to DBMS support? I would hope / expect to get a straight "ranking not supoorted" and not incorrect data back ...
    Thanks for your answer anyway!
    Regards,
    Stefan

  • CardDav in Contacs not working correctly

    The implementation of groups in the CardDav-protocol is not correct. I have a CardDav-service from my ISP. It works correctly on iOS, but not in OS X. The problem is that the moment I create a group, only the contacts in a group are displayed. That is: of course in the group, but also in 'all contacts'. Removing the group brings the whole list back.
    The problem was already present in earlier version. I hoped Yosemite would solve it. But it is still there.

    Hello David,
    I use an OLE DB connection to a MS SQL Server 2005.
    Connection Details say:
    Version 2.0.0.29
    Build 12.1.0.882
    Network Layer OLE DB
    DBMS Engine MS SQL Server 2205
    Database used is MS AdventureWorksDW sample database (data warehouse sample)
    I noticed that only with this database, ranking is selectable (not with the AdventureWorks non-DW sample database).
    Ranking itself seems to work, if I activated ranking (e.g. Top 10 customers) everything is ok.
    (Also if I  send a direct SQL command with ranking to the DBMS, it seems ok.)
    Issue arise if I add year filter. Combination of rank and year filter does not seem to work properly.
    Any idea why? Or do you wanted to say that this issue might also be related to DBMS support? I would hope / expect to get a straight "ranking not supoorted" and not incorrect data back ...
    Thanks for your answer anyway!
    Regards,
    Stefan

  • Whats the difference between Rich Client and Desktop Client? (BO XI 3.2)

    Hello,
    maybe someone has a matrix oder something like that?
    Thanks for helping...
    Biegel

    There are a number of reasons for using Web Intelligence Rich Client to
    work with WID documents:
    u2022 You want to work with Web Intelligence documents but you are unable
    to connect to a CMS (while traveling, for example).
    u2022 You want to improve calculation performance: Web Intelligence Rich
    Client performs calculations locally, rather than on the server, and local
    calculations can perform better than server calculations.
    u2022 You want to work with Web Intelligence documents without installing a
    CMS or application server.
    Deski
    1. VB Macro
    2. Slice and Dice functionality
    3. Database Ranking is not there
    4. Column can be conditionally hidden
    5. Free-hand sql, SP can be used as data providers
    6. No time out error.
    7. Needs to be installed on all the desktop machines
    Gracias...!!

  • BW query conditions

    Hi guys,
    I'm a BW consultant and I've built a universe over a BW query with TopX condition.
    It should have got back only 5 records, but in QaaWS I get all records.
    I have the same problem when I try to sort the data in BW using a condition.
    Any suggestios?
    Shlomi Weiss

    Hi Shlomi,
    You can use the where clause for the top X in the QAAWS directly.
    In QAAWS you need to select the database ranking and then in the filter option you need to select the Top and select the field on which you want to apply the sort and then drag the feild(on which you want to apply the where clause) just below the Top filter and it automatically appends the where clause.
    Please let me know if you are able to get through this.
    Thanks,
    Amit.

  • How to create a Top 10 based on values from a database?

    I have a database table that stores scores for events, like a rating system.
    Users choose an event they want to score, enter their score/rating and insert this into the database table.
    This gives me, in my table:
    Event - Rating - User
    Soccer - 5 - Joe Public
    Soccer - 4.5 - Jane Public
    Tennis - 3 - Joe Public
    ...and so on.
    I would like to do two things.  Firstly, I need to calculate the average for each event, which is easy enough, although I haven't quite got my head around the GROUP BY clause which, as I understand it, only allows me to use one database field?
    Secondly, I would like to display, dynamically from the database, a list of top 10 events based on the results of the average ratings.
    How easy is this to achieve?  I'm using ASP/VBScript and MSSQL database.
    Appreciate any advice offered.  Thanks.
    Regards
    Nath.

    Hi.  Here is what I've got, so far, to calculate the average:
    SELECT     AVG(mgscore) AS mgAVGscore, mgmovieID, mgmovie, mgmovierelease
    FROM         dbo.MGreviews
    GROUP BY mgmovieID, mgmovie, mgmoviecert, mgmovierelease
    How would I then run the RANK function?  Here's the example you provided:
    SELECT RANK() OVER (ORDER BY Age) AS [Rank by Age],
           FirstName,
           Age
      FROM Person
    I've tried this:
    SELECT     RANK () OVER ORDER BY AVG(mgscore) AS mgAVGscore AS [Rank by Score], mgmovieID, mgmovie, mgmovierelease
    FROM         dbo.MGreviews
    GROUP BY mgmovieID, mgmovie, mgmoviecert, mgmovierelease
    ...but this produces the following error:
    Error in list of function arguments: 'AS' not recognized.  Can you help?  I'm not sure I'm quite understanding how the RANK function works.
    Much appreciate.
    Regards
    Nath.

  • Sql query slowness due to rank and columns with null values:

        
    Sql query slowness due to rank and columns with null values:
    I have the following table in database with around 10 millions records:
    Declaration:
    create table PropertyOwners (
    [Key] int not null primary key,
    PropertyKey int not null,    
    BoughtDate DateTime,    
    OwnerKey int null,    
    GroupKey int null   
    go
    [Key] is primary key and combination of PropertyKey, BoughtDate, OwnerKey and GroupKey is unique.
    With the following index:
    CREATE NONCLUSTERED INDEX [IX_PropertyOwners] ON [dbo].[PropertyOwners]    
    [PropertyKey] ASC,   
    [BoughtDate] DESC,   
    [OwnerKey] DESC,   
    [GroupKey] DESC   
    go
    Description of the case:
    For single BoughtDate one property can belong to multiple owners or single group, for single record there can either be OwnerKey or GroupKey but not both so one of them will be null for each record. I am trying to retrieve the data from the table using
    following query for the OwnerKey. If there are same property rows for owners and group at the same time than the rows having OwnerKey with be preferred, that is why I am using "OwnerKey desc" in Rank function.
    declare @ownerKey int = 40000   
    select PropertyKey, BoughtDate, OwnerKey, GroupKey   
    from (    
    select PropertyKey, BoughtDate, OwnerKey, GroupKey,       
    RANK() over (partition by PropertyKey order by BoughtDate desc, OwnerKey desc, GroupKey desc) as [Rank]   
    from PropertyOwners   
    ) as result   
    where result.[Rank]=1 and result.[OwnerKey]=@ownerKey
    It is taking 2-3 seconds to get the records which is too slow, similar time it is taking as I try to get the records using the GroupKey. But when I tried to get the records for the PropertyKey with the same query, it is executing in 10 milliseconds.
    May be the slowness is due to as OwnerKey/GroupKey in the table  can be null and sql server in unable to index it. I have also tried to use the Indexed view to pre ranked them but I can't use it in my query as Rank function is not supported in indexed
    view.
    Please note this table is updated once a day and using Sql Server 2008 R2. Any help will be greatly appreciated.

    create table #result (PropertyKey int not null, BoughtDate datetime, OwnerKey int null, GroupKey int null, [Rank] int not null)Create index idx ON #result(OwnerKey ,rnk)
    insert into #result(PropertyKey, BoughtDate, OwnerKey, GroupKey, [Rank])
    select PropertyKey, BoughtDate, OwnerKey, GroupKey,
    RANK() over (partition by PropertyKey order by BoughtDate desc, OwnerKey desc, GroupKey desc) as [Rank]
    from PropertyOwners
    go
    declare @ownerKey int = 1
    select PropertyKey, BoughtDate, OwnerKey, GroupKey
    from #result as result
    where result.[Rank]=1
    and result.[OwnerKey]=@ownerKey
    go
    Best Regards,Uri Dimant SQL Server MVP,
    http://sqlblog.com/blogs/uri_dimant/
    MS SQL optimization: MS SQL Development and Optimization
    MS SQL Consulting:
    Large scale of database and data cleansing
    Remote DBA Services:
    Improves MS SQL Database Performance
    SQL Server Integration Services:
    Business Intelligence

  • How to connect Oracle database in BIP 11g

    Hi experts I am trying to connect to oracle Database with BIP.
    I am using
    jdbc:oracle:thin:@host:port:SID
    but getting the error could not connect.
    where i can see the log...?

    Hi,
    Try this
    Give me Connection string like this ****** jdbc:oracle:thin:@//10.102.5.116:1522/orcl --- instead of ( jdbc:oracle:thin:@host:port:SID)
    Hope this help's
    Thanks
    Satya
    Edited by: Satya Ranki Reddy on Jun 18, 2012 1:49 PM

  • How to use Electroserver's built in Derby Database?

    hello. I am trying to create an online multiplayer game with electroserver like here:
    http://gamesfromjames.weebly.com/pickit.html
    I was looking at the source code from electrotank. Unfortunately, I cannot compile it in flash CS6 because the document class is in mxml.(if someone can help me figure out how to test these examples  in pure as3 that would be great)  I did find these two functions in hte mxml class:
                 * Increases your rank by the amount specified by sending a properly formatted message to the plugin.
                private function addToRankClicked():void {
                    var ipr:PluginRequest = new PluginRequest();
                    ipr.pluginName = "DatabasePlugin";
                    var esob:EsObject = new EsObject();
                    esob.setString(PluginConstants.ACTION, PluginConstants.TAG_ADD_TO_RANK);
                    esob.setInteger(PluginConstants.TAG_ADD_TO_RANK, rankDeltaStepper.value);
                    ipr.parameters = esob;
                    _es.engine.send(ipr)
                 * Loads your rank from the database by asking the plugin for it.
                private function getRank():void {
                    var ipr:PluginRequest = new PluginRequest();
                    ipr.pluginName = "DatabasePlugin";
                    ipr.zoneId = -1;
                    ipr.roomId = -1;
                    var esob:EsObject = new EsObject();
                    esob.setString(PluginConstants.ACTION, PluginConstants.TAG_GET_RANK);
                    ipr.parameters = esob;
                    _es.engine.send(ipr)
    Is this all that is needed to put things into the database and take things out or am I missing something?
    If I was going to try to save the chat history and show it every time a user enters the chat room, how would I go about doing it with electroserver's derby database?
    Thanks!

    Use Flex/Flashbuilder to compile mxml source code.
    There are many Flash Games on their Example site: http://www.electrotank.com/docs/es5/manual/

  • 2 of my personas dissappeared 'My Gallery' since they've rearranged the viewingorder (from highest ranking to creationdate), and 2 of them are showing double. My designer name is 'Nielske' and the personas not showing in my gallery are: "Madonna - Intervi

    2 of my personas dissappeared from 'My Gallery' since they've rearranged the viewingorder (from highest ranking to creationdate), and 2 of them are showing double. My designer name is 'Nielske' and the personas not showing in my gallery are: "Madonna - Interview Magazine Collection" and "Madonna - Interview Magazine 4". However they are showing in the complete Persona Database if searched under Madonna (page 5).
    == This happened ==
    Every time Firefox opened
    == the personas in My Gallery (Personas by designer Nielske) got sorted bij date of creation instead of highest ranking

    I have the same problem.
    Here is the link to my gallery - http://www.getpersonas.com/en-US/gallery/Designer/manishp100
    as you will see these two, at least, do not appear - I cant remember if there are more that dont.. im sure there might be -
    http://www.getpersonas.com/en-US/persona/245197
    http://www.getpersonas.com/en-US/persona/245212

Maybe you are looking for

  • Once and for all: How to set up and use SSH

    Yes, I know ssh has been discussed on and off, but never in its entirety; and yes, there are step by step instructions on the www, but at one point or another they skip a crucial instruction that would be necessary for unix-dummies (e.g. how to save

  • List Builder only shows 1 data set at a time

    Am attempting to get a list builder to display multiple data sets but am hitting a wall.  When a 1st data set is selected then all OK.  Add 2nd data set and update list and only 1st is shown.  Remove 1st and update and data is refreshed to 2nd list. 

  • Want to install Windows 7 64 bit to DV4T-5200

    I'll keep it short - my wife hates Windows 8.  She also hates 8.1.   I am trying to install Windows 7 64 bit to her DV4T-5200 laptop, and I have never had so much trouble getting an OS installed before.  Does anyone know what BIOS settings I need to

  • 8330 + Mac Sync

    I am having several issues with my 8330 & my mac. The biggest problem is memos & tasks. When I sync, I get multiple empty memos on my phone. My calendar & contacts don't always sync. I am using Entourage (Office 2008). Any help / suggestions would be

  • Using mac mini on a dell desktop

    can i use my mac mini on a regular desktop or does it have to be only on an apple?