Jump to content

Display 1 to 100


Hasti

Recommended Posts

Hello

      I want to display value from 1 to 100

     

      Result

----------------------

    fieldname

---------------------

        1

        2

        .

        .

      100

 

This way i want to display using select query...

 

Link to comment
Share on other sites

Ok Lets forget it.

    What i need is this.. suppose for example, a X table contain 10 rows in table with primary key as auto increment. now suppose i deleted the 4th row than now i want to use that deleted auto increment key  for new record insertion. Through query only without using php code.

 

Link to comment
Share on other sites

Hi

 

While I agree that you shouldn't insert into an auto increment field, you can get a range of numbers.

 

Have a table (say call it integer) with a single column called i, with 10 rows of 0 to 9.

 

You can get the numbers 0 to 9 by doing SELECT i FROM integer.

 

To get 0 to 99 do SELECT a.i*10+b.i FROM integer a, integer b

 

So to get 40 to 80:-

 

SELECT *

FROM (SELECT a.i*10+b.i as SomeNumber FROM integer a, integer b)

WHERE SomeNumber BETWEEN 40 and 80

 

All the best

 

Keith

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.