Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SQL Problem 1

Status
Not open for further replies.

nilin

Programmer
Aug 14, 2003
26
Hi,
Can some one help me in solving one SQL problem!
I have 10 records in a table, i want a SQL which should select from record 4 to 10 , first 3 records i want to skip. (informix SQL)
thank you,
nilin
 
Hi!

Newer versions of informix can select the first n records of a table, so if you can sort your records upside-down, you could do the following:

Code:
select first 7 * from mytable
order by key desc;

So the last 3 records are not selected.

Please notice that this syntax can not be used in every context.

Not allowed is ..

? In the definition of a view
? In nested SELECT statements
? In subqueries
? In a singleton SELECT (where max = 1) within an SPL routine
? In the SELECT clause of an INSERT statement
? In a SELECT statement that inserts the retrieved data into another table, such as a temporary, scratch, or external table
? Where embedded SELECT statements are used as expressions
? As part of a UNION query
? In a distributed query on a remote database server

(taken from Informix-SQL-Docs)

Hope this helps.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top