Seite 1 von 1

php: denkaufgabe!

Verfasst: 16.09.2004 18:29
von TartaroZ
Hi you developers,

please help me to MOVE A GENRE in the following table. i have a mysql-table like this ( I cannot change the table, it's not my project!!):

Code: Alles auswählen

mysql> select id, genre from genre limit 16;
+----+---------------------+
| id | genre               |
+----+---------------------+
| b  | Alternative         |
| ba | Alternative General |
| bb | Art Rock            |
| bc | Avant Rock          |
| bd | Experimental        |
| bh | Grunge              |
| bi | Indie               |
| bm | Unclassifiable      |
| bn | Crossover           |
| c  | Books & Spoken      |
| ca | Short Stories       |
| cb | Comedy              |
| cc | Musicals/Broadway   |
| cd | Poetry              |
| ce | Cabaret / Satire    |
| cf | Religion            |
+----+---------------------+
16 rows in set (0.00 sec)
that means: Alternative General, Art Rock, ... are sub-genres of the "Alternative"-genre.

i.e. i want to move the genre "Comedy" with the id "cb" to be a child of "Alternative" with the id "a".

does anybody have an idea to manage this with a few queries? the problem is, if i change the id of a genre, i have to change this genre-id in thousands of tracks and albums.

the genre-names of each sub-genre should by ordered by the alphabet ascending, so that the example would look like this:

Code: Alles auswählen

...
| b  | Alternative         |
| ba | Alternative General |
| bb | Art Rock            |
| bc | Avant Rock          |
| bd | Comedy              |
| be | Experimental        |
| bh/bf | Grunge              |
any ideas? pleas help!
mfg phil

Verfasst: 17.09.2004 09:54
von musashi
Du kannst im deutschen Forum auch ruhig Deine Muttersprache verwenden :-)

Verfasst: 17.09.2004 22:25
von TartaroZ
ich hab das in mehreren foren gepostet, deswegen ist es englisch!