Table from columns
Posted: Thu Mar 01, 2012 2:22 am
I’m working in php/mysql. I’m a starter and I have a problem.
I have connected with my database and I want to create a table from the database’s table:
The first one is a table in my database with all users’ data. (they are all numerical)
- - - - - - - - - - - - - - - - - - - - - -
| id | age | score | bonus |
- - - - - - - - - - - - - - - - - - - - - -
| 1 | 17 | 39 | 10 |
- - - - - - - - - - - - - - - - - - - - - -
| 2 | 12 | 31 | 10 |
- - - - - - - - - - - - - - - - - - - - - -
| 3 | 15 | 35 | 20 |
- - - - - - - -- - - - - - - - - - - - - - -
| 4 | 11 | 32 | 30 |
- - - - - - - - - - - - - - - - - - - - - - -
| 5 | 12 | 49 | 10 |
- - - - - - - - - - - - - - - - - - - - - - - -
etc…………………………………………………………
I want to create a table ‘Ages’ using the first two columns like that:
--- - - - - - - - - -
| id | age |
| 1 | 17 |
| 1 | 12 |
| 1 | 15 |
| 1 | 11 |
| 5 | 12 |
- - - - - - -- - - -
How could I do that?
I have connected with my database and I want to create a table from the database’s table:
The first one is a table in my database with all users’ data. (they are all numerical)
- - - - - - - - - - - - - - - - - - - - - -
| id | age | score | bonus |
- - - - - - - - - - - - - - - - - - - - - -
| 1 | 17 | 39 | 10 |
- - - - - - - - - - - - - - - - - - - - - -
| 2 | 12 | 31 | 10 |
- - - - - - - - - - - - - - - - - - - - - -
| 3 | 15 | 35 | 20 |
- - - - - - - -- - - - - - - - - - - - - - -
| 4 | 11 | 32 | 30 |
- - - - - - - - - - - - - - - - - - - - - - -
| 5 | 12 | 49 | 10 |
- - - - - - - - - - - - - - - - - - - - - - - -
etc…………………………………………………………
I want to create a table ‘Ages’ using the first two columns like that:
--- - - - - - - - - -
| id | age |
| 1 | 17 |
| 1 | 12 |
| 1 | 15 |
| 1 | 11 |
| 5 | 12 |
- - - - - - -- - - -
How could I do that?