var sidebar_align = 'right';
var content_container_margin = parseInt('290px');
var sidebar_width = parseInt('270px');
Unanswered: Select top DB2
Somebody could help me with this query?
select top 10 * from table1 where code not in (select top 5 code from table1)
I tried it but DB2 do not support top. I used fetch first row only
My problem is that in the first query the fetch first row only work well but in the second subquery do not work well.
thank you in advance
What version of db2 are you using ???? Please always include this information.
On DB2 LUW V8 FP10, this works
select * from syscat.tables where tbspace not in (select tbspace from syscat.tablespaces fetch first 10 rows only) fetch first 10 rows only with ur
Visit the new-look IDUG Website
, register to gain access to the excellent content.
Originally Posted by sathyaram_s
I am trying to excute this query using ODBC client access that connect to IBM AS400 with DB2 V5R3
using 'fetch' in subselect is new functionality of DB2 v8.1
Here is the DB2 script to display first 50 rows : select * from DBO.Table1 fetch first 50 rows only
For SQL Server t-sql script it is select Top 50 * from DBO.Table1