If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > Unix Shell Scripts > How to suppress exceeding number of records

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 02-25-03, 13:30
H303 H303 is offline
Registered User
 
Join Date: Feb 2003
Location: South Germany
Posts: 3
How to suppress exceeding number of records

Is there any way how to limit the number of returned records to a certain value? I have a table which holds millions of measurement data and timestamps. When I do a select for a certain time range, I may get back thousends of records and I only need to present the first 25 for a preview.
The function COUNT(*) will not work, since I cannot calculat something like ... select where ... COUNT(*) > (COUNT(*) -25)
Many thanks for every hint!
Hermann
Reply With Quote
  #2 (permalink)  
Old 02-26-03, 03:05
stevetucknott stevetucknott is offline
Registered User
 
Join Date: Jan 2003
Posts: 19
Within Informix there is a directive that you can give that will limit the rows returned (Not sure which release this appeared in though, so you'll have to check your documentation).... the syntax is:

SELECT FIRST n column_name FROM table_name

eg

SELECT FIRST 10 * FROM systables

OR

SELECT FIRST 3 tabid,tabname FROM systables
Reply With Quote
  #3 (permalink)  
Old 02-27-03, 07:11
thebap thebap is offline
Registered User
 
Join Date: Feb 2003
Posts: 45
MySQL - also uses the LIMIT keyword

For Oracle - SELECT * FROM TABLE_XXX WHERE ROWNUM < 100;
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On