How can i retrieve record ONLY From 300 - 400 in amillion Record Table?

Ask a Question related to Coldfusion Database Access, Design and Development.

  1. #1

    Default How can i retrieve record ONLY From 300 - 400 in amillion Record Table?

    HI all
    Thanks for your time.. I have a question here..
    How can i retrieve record ONLY From XXX - XXX in a million Record Table?
    eg.
    I have a table , UserMaster hold 1000 Record.
    I just want to retrieved ONLY record from 300 - 400 active record?
    The table have a ID and auto added by one.
    Some record maybe deleted. eg.. the ID may hold 1..
    4,5,7,9,10...15,17,19,20,21,22....

    Database used : MSSQL / Oracle


    Thanks for help.

    Regard
    keonglah

    keonglah Guest

  2. Similar Questions and Discussions

    1. Insert Record and Retrieve autonumber extension
      I followed the instructions for useage correctly: http://www.tom-muck.com/extensions/help/insertretrieve/ Unfortunately it is producing the error...
    2. Record Set table layout?
      I don't have a problem laying out a recordset in php/mysql, but each record is returned in a single row of a table file. Is there a way to return...
    3. Copy a record to another table?
      Hello friends!! I have two forms each with its own subform. The first form consist of a main form with a subform for PARTS COSTS,(a...
    4. post record to table
      Hi all, I have a form with a combo box. When my user makes a selection from this combo box, 3 other fiields on the form are populated with data...
    5. Stop adding record in subform after record count = 1
      Can someone help in in what to put after the THEN statment to allow one entry if the Record count is =>1 in the Before insert or should I set the...
  3. #2

    Default Re: How can i retrieve record ONLY From 300 - 400 in amillion Record Table?

    Hi there

    You can try this - it seems to work

    SELECT *
    FROM tableX
    WHERE rowid in (
    SELECT rowid FROM tableX
    WHERE rownum <= 400
    MINUS
    SELECT rowid FROM tableX
    WHERE rownum < 300);

    Thius will retrieve all records with a row number between 300 & 400

    Hope this helps


    toby007 Guest

  4. #3

    Default Re: How can i retrieve record ONLY From 300 - 400 in amillion Record Table?

    Why not nto use simple
    SELECT *
    FROM tableX
    WHERE rownum between 300 and 400?
    CF_Oracle Guest

  5. #4

    Default Re: How can i retrieve record ONLY From 300 - 400 in amillion Record Table?

    SELECT *
    FROM tableX
    WHERE rownum between 300 and 400?

    Did you try it? Because it returns no rows. Oracle begins the calculation of rownum at 1 for any recordset it returns.

    JR


    jonwrob Guest

  6. #5

    Default Re: How can i retrieve record ONLY From 300 - 400 in amillion Record Table?

    JR, you are right. I used not autonumber but regular number coulmn format.
    CF_Oracle Guest

  7. #6

    Default Re: How can i retrieve record ONLY From 300 - 400 in amillion Record Table?

    If this is for paging.

    Try this:
    SELECT TOP 100 * FROM tablex
    for the first set then record the last record ID. Then for the second,
    third... pages
    SELECT TOP 100 * FROM tablex WHERE ID > #URL.lastID#



    krisbrixon Guest

  8. #7

    Default Re: How can i retrieve record ONLY From 300 - 400 in amillion Record Table?

    HI.. Thanks for all reply..

    Maybe i try to rewrite my question..~

    Im have a table , for example, UserMaster hold million Records. I would like
    to generate a page where is only show 100 Records and there is a next and
    previous button allow user move to the next or pevious page. IF just used a
    [select fiend Name from UserMaster] it will store million of record in a memory
    but i just want to used only 100 Record per page. Inorder to avoid this, how
    can i retrieved ONLY 100 active record per page by using query, store pro or
    view?

    Senario
    The table have field call UserID and auto added by one.
    Some record maybe deleted.
    eg.. The ID in the table will be like.. 300,301,302,305,306..400 (303 and 304
    record is deleted.) Inorder to retrieved 100 record per page.. the ID is start
    from 300 till 402.


    To krisbrixon :
    >If this is for paging.
    >Try this:
    >SELECT TOP 100 * FROM tablex
    >for the first set then record the last record ID. Then for the second,
    third... pages
    >SELECT TOP 100 * FROM tablex WHERE ID > #URL.lastID#
    This is a pretty good idea.. but i guess we have to change url.lastID to
    session.lastID to avoid user manually change the ID.

    How bout using the following query?
    SELECT TOP 100 * FROM tablex
    WHERE ID beteween [StartID] add [EndID]

    Question.. How can i get the StartID and EndID value??

    keonglah Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139