Why can't I use informix subqueries first

Why can't I use select in a subquery? Here I have a pseudo selection that throws an exception:Cannot use 'first', 'limit' or 'skip' in this context.

I do not understand why. I want to select the first 10 identifiers, and then in the other rows of the table that are in this set

select * from Table1 where ID in ( select  first 10  ID from Table2)

How do I rewrite this choice?

+4
source share
2 answers

This is not very pretty, but it seems to work:

SELECT * FROM _tmp_table 
WHERE id IN 
   (SELECT id FROM 
      (SELECT FIRST 10 id FROM _tmp_table)
   )
+7
source

...
, IBM Informix , Informix... ( RFE IBM RFE)

Informix, , :

Projection SKIP, FIRST LIMIT :

  • SELECT
  • , FROM
  • , SKIP, FIRST LIMIT.

, @Michael , , ... 11.70.

$ dbaccess -e sysmaster x.sql

Database selected.


select first 10 tabname[1,20] from systables
;

tabname

systables
syscolumns
sysindices
systabauth
syscolauth
sysviews
sysusers
sysdepend
syssynonyms
syssyntable

10 row(s) retrieved.


select t.tabname[1,20] from (select first 2 * from systables) as  t


tabname

systables
syscolumns

2 row(s) retrieved.


Database closed.
+5

Source: https://habr.com/ru/post/1533440/


All Articles