Update of /cvsroot/monetdb/sql/src/test/BugTracker-2009/Tests
In directory 
23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv15560/src/test/BugTracker-2009/Tests

Added Files:
        orderby_with_row_number.SF-2895791.sql 
Log Message:
propagated changes of Friday Nov 13 2009
from the Nov2009 branch to the development trunk

  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2009/11/13 - nielsnes:
          
src/test/BugTracker-2009/Tests/orderby_with_row_number.SF-2895791.sql,1.1.2.1
  add test for bug in over (partion by order by).
  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


--- NEW FILE: orderby_with_row_number.SF-2895791.sql ---
create table "table1" ("customer" varchar(40), "product" varchar(40), "price" 
double);
insert into "table1" values ('cust1', 'p1', 100);
insert into "table1" values ('cust1', 'p2', 200);
insert into "table1" values ('cust1', 'p3', 150);
insert into "table1" values ('cust2', 'p1', 300);
insert into "table1" values ('cust2', 'p3', 200);

SELECT "customer", "product", "sumprice", (Row_number() OVER(PARTITION BY 
"customer" ORDER BY "sumprice")) as "rank" FROM ( SELECT "customer", "product", 
(Sum("price")) AS "sumprice" FROM "table1" GROUP BY "customer", "product") AS 
"temp";

/*
Customer product sumprice rank
Cust1 p1 100 1
Cust1 p2 200 2
Cust1 p3 150 3
Cust2 p1 300 1
Cust2 p3 200 2

But it should return:
Customer product sumprice rank
Cust1 p1 100 1
Cust1 p3 150 2
Cust1 p2 200 3
Cust2 p3 200 1
Cust2 p1 200 2 
*/

DROP TABLE "table1";


------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Monetdb-sql-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/monetdb-sql-checkins

Reply via email to