I am using Informix database (version 7.32). In one operation, I create a temporary table with the identifier of a regular table and a sequential column (so that I will have all the identifiers from a regular table, numbered continuously). But I want to insert information from a regular table, sorted by ID, for example:
CREATE TEMP TABLE tempTable (id serial, folio int );
INSERT INTO tempTable(id,folio)
SELECT 0,folio FROM regularTable ORDER BY folio;
But this creates a syntax error (due to ORDER BY)
Is there a way to order information and then paste it into tempTable?
UPDATE: the reason I want to do this is because the regular table contains about 10,000 elements and in the jsp file, it should show each record, but it will take a lot of time, so the real reason I want this to do is pagination. This version of Informix does not Limitand Skip. I can’t renumber the serial number because it’s in a relationship, and this is the only solution where you can get a fixed number of results on one page (for example, 500 results per page). An identifier (called a folio) is missing in a regular table because they have been deleted. if i put
SELECT * FROM regularTable WHERE folio BETWEEN X AND Y
I could possibly get 300 on one page and then 500 on the next page
source
share