MySQL Forums
Forum List  »  General

Re: Entering particular data
Posted by: laptop alias
Date: May 20, 2012 05:46AM

I suspect that the OP is after something more like this, although (to the OP) combining a sequential integer with a string in this way is rarely a 'good idea'...
SELECT * FROM ints;
+---+
| i |
+---+
| 0 |
| 1 |
| 2 |
| 3 |
| 4 |
| 5 |
| 6 |
| 7 |
| 8 |
| 9 |
+---+

CREATE TABLE links(link VARCHAR(12) NOT NULL);

INSERT INTO links(link) SELECT CONCAT('link',i2.i*10+i1.i) FROM ints i1, ints i2 WHERE i2.i*10+i1.i < 50;
Query OK, 50 rows affected (0.01 sec)
Records: 50  Duplicates: 0  Warnings: 0

SELECT * FROM links;
+--------+
| link   |
+--------+
| link0  |
| link1  |
| link2  |
| link3  |
| link4  |
| link5  |
| link6  |
| link7  |
| link8  |
| link9  |
| link10 |
| link11 |
| link12 |
| link13 |
| link14 |
...
| link44 |
| link45 |
| link46 |
| link47 |
| link48 |
| link49 |
+--------+
50 rows in set (0.00 sec)

Options: ReplyQuote


Subject
Written By
Posted
May 18, 2012 03:57PM
Re: Entering particular data
May 20, 2012 05:46AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.