[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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 <mysql-thread92341@xxxxxxxxxxxxxxx>
: To unsubscribe, e-mail <mysql-unsubscribe-sherzod=ultracgis.com@xxxxxxxxxxxxxxx>
: Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
:

-- 
sherzodR <sherzodr@xxxxxxxxxx>
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 <mysql-thread92343@xxxxxxxxxxxxxxx>
To unsubscribe, e-mail <mysql-unsubscribe-treed=ultraviolet.org@xxxxxxxxxxxxxxx>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php



This mailing list archive is a service of Copilot Consulting.