MySql

Mani2803

Benutzer
Beiträge
5
Hi,

bin Anfänger und habe eine Frage

ich habe eine Spalte und dort werden mir Kontinente angezeigt,

Ich möchte alle Kontinente anzeigen lassen aber wird mir zum Beispiel auch

Türkei,Europe
Europe
Asia
North America angezeigt.


Wie kann ich jetzt die Türkei in die Zeile Europe einfügen?

Danke
 
Werbung:
Danke dir. Freut mich

Es steht bei der Spalte Kontinenten

Kontinente:
Türkei,Europe
Europe
Asia
North America

wie kann ich jetzt die erste Zeile (Türkei,Europe) in die zweite Zeile (Europe) einfügen damit nur die zweite Zeile(Europe) vorhanden ist. Also das quasi (Türkei,Europe) in die Zeile (Europe) eingefügt wird.

Mit welchem Befehl?
 
Code:
test=# create table mani2803(kontinente text);
CREATE TABLE
test=*# copy mani2803 from stdin;
Enter data to be copied followed by a newline.
End with a backslash and a period on a line by itself, or an EOF signal.
>> Türkei,Europa
>> Europa
>> Asia
>> Nordamerika
>> \.
COPY 4
test=*# select * from mani2803 ;
  kontinente   
---------------
 Türkei,Europa
 Europa
 Asia
 Nordamerika
(4 rows)
test=*# with delete as (delete from mani2803 where kontinente = 'Türkei,Europa' returning kontinente) update mani2803 set kontinente = mani2803.kontinente || delete.kontinente from delete where mani2803.kontinente = 'Europa';
UPDATE 1
test=*# select * from mani2803 ;
     kontinente     
---------------------
 Asia
 Nordamerika
 EuropaTürkei,Europa
(3 rows)

test=*#
 
ok, danke erstmal aber (Türkei,Europe) sollte zu (Europe) hinzugefügt werden und komplett verschwinden(als Land dazugezählt werden bei (Europe)). Geht das überhaupt?

Danke
 
Werbung:
Klar doch!

Code:
test=*# delete from mani2803 where kontinente = 'Türkei,Europa';
DELETE 1
test=*# select * from mani2803 ;
 kontinente  
-------------
 Europa
 Asia
 Nordamerika
(3 rows)

Bleib gesund!
 
Zurück
Oben