Hasti Posted August 20, 2009 Share Posted August 20, 2009 Hello Everyone I want to display value from 1 to 100 using select query without using table name.. Thanks in Advance Quote Link to comment https://forums.phpfreaks.com/topic/171134-display-1-to-100/ Share on other sites More sharing options...
trq Posted August 20, 2009 Share Posted August 20, 2009 What exactly do you mean? Quote Link to comment https://forums.phpfreaks.com/topic/171134-display-1-to-100/#findComment-902464 Share on other sites More sharing options...
Hasti Posted August 20, 2009 Author Share Posted August 20, 2009 Hello I want to display value from 1 to 100 Result ---------------------- fieldname --------------------- 1 2 . . 100 This way i want to display using select query... Quote Link to comment https://forums.phpfreaks.com/topic/171134-display-1-to-100/#findComment-902466 Share on other sites More sharing options...
trq Posted August 20, 2009 Share Posted August 20, 2009 Nope, still not making much sense. Quote Link to comment https://forums.phpfreaks.com/topic/171134-display-1-to-100/#findComment-902467 Share on other sites More sharing options...
Hasti Posted August 20, 2009 Author Share Posted August 20, 2009 Hello for example select 1+1 it will output as 2 Now i want in same way to display a range between 1 to 100 using select query. Is this possible Quote Link to comment https://forums.phpfreaks.com/topic/171134-display-1-to-100/#findComment-902472 Share on other sites More sharing options...
trq Posted August 20, 2009 Share Posted August 20, 2009 Yeah, i'm not sure that can easily be done. May I ask why that would be at all useful? Quote Link to comment https://forums.phpfreaks.com/topic/171134-display-1-to-100/#findComment-902476 Share on other sites More sharing options...
Hasti Posted August 20, 2009 Author Share Posted August 20, 2009 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. Quote Link to comment https://forums.phpfreaks.com/topic/171134-display-1-to-100/#findComment-902480 Share on other sites More sharing options...
trq Posted August 20, 2009 Share Posted August 20, 2009 Why would you want to do that? Auto incrementing keys should not be manually manipulated, they are there simply to keep data integrity. Quote Link to comment https://forums.phpfreaks.com/topic/171134-display-1-to-100/#findComment-902481 Share on other sites More sharing options...
Hasti Posted August 20, 2009 Author Share Posted August 20, 2009 In registration form they need the registration No in sequence order thats why i need this. Quote Link to comment https://forums.phpfreaks.com/topic/171134-display-1-to-100/#findComment-902482 Share on other sites More sharing options...
trq Posted August 20, 2009 Share Posted August 20, 2009 Going backward and getting old numbers is not exactly a sequence. Besides, you can't insert a record into an auto incrementing field. Quote Link to comment https://forums.phpfreaks.com/topic/171134-display-1-to-100/#findComment-902486 Share on other sites More sharing options...
kickstart Posted August 20, 2009 Share Posted August 20, 2009 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 Quote Link to comment https://forums.phpfreaks.com/topic/171134-display-1-to-100/#findComment-902495 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.