I dont think you can do that, but if you create a table counter with one number column and insert all the numbers from 1 to 100000 or what number would be appropriate, then you can left join your_table with counter on the id = number column.
select * from counter left join your_table on counter.number = your_table.id order by your_table.id TK > -----Opprinnelig melding----- > Fra: Jamie Burns [mailto:[EMAIL PROTECTED]] > Sendt: 27. november 2001 14:28 > Til: sherzodR > Kopi: [EMAIL PROTECTED] > Emne: Re: can i do this with sql? > > > i actually need the id's with no row returned as if they were there (but > with default values)... they do not need to be inserted into the > table, just > returned as if they were in there. > > j > > ----- Original Message ----- > From: "sherzodR" <[EMAIL PROTECTED]> > To: "Jamie Burns" <[EMAIL PROTECTED]> > Cc: <[EMAIL PROTECTED]> > Sent: Tuesday, November 27, 2001 1:24 PM > Subject: Re: can i do this with sql? > > > > > > > > i belive you want..: > > > > SELECT * FROM your_table WHERE id < 9 ORDER BY id LIMIT 9; > > > > But when it comes to generating missing items... I'm not sure if > > i got you right though, but they should exist. MySQL cannot > > make the rows that do not exist > > > > > > > > Jamie Burns wrote: > > > > : Hi all, > > : > > : I have a table like this: > > : > > : id data year > > : > > : 1 2 01 > > : 2 2 01 > > : 6 2 01 > > : 7 2 01 > > : 8 2 01 > > : 11 2 01 > > : > > : What i want to be able to get is these results from an sql > query (given > that > > : i want id's 1-9): > > : > > : id data year > > : > > : 1 2 01 > > : 2 2 01 > > : 3 0 0 > > : 4 0 0 > > : 5 0 0 > > : 6 2 01 > > : 7 2 01 > > : 8 2 01 > > : 9 0 0 > > : > > : Basically it has made up the rows with id's 3,4, 5 and 9 because they > didnt > > : exist in the table. > > : > > : Can anybody give me any clues how to achieve this? > > : > > : Thanks, > > : > > : Jamie Burns. > > : > > : > > : --------------------------------------------------------------------- > > : Before posting, please check: > > : http://www.mysql.com/manual.php (the manual) > > : http://lists.mysql.com/ (the list archive) > > : > > : To request this thread, e-mail <[EMAIL PROTECTED]> > > : To unsubscribe, e-mail > <[EMAIL PROTECTED]> > > : Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php > > : > > > > -- > > sherzodR <[EMAIL PROTECTED]> > > use CGI::Session; > > > --------------------------------------------------------------------- > Before posting, please check: > http://www.mysql.com/manual.php (the manual) > http://lists.mysql.com/ (the list archive) > > To request this thread, e-mail <[EMAIL PROTECTED]> > To unsubscribe, e-mail <[EMAIL PROTECTED]> > Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php > --------------------------------------------------------------------- Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail <[EMAIL PROTECTED]> To unsubscribe, e-mail <[EMAIL PROTECTED]> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php