Thread View: pl.comp.bazy-danych
6 messages
6 total messages
Started by Borneq
Sat, 21 Jan 2017 18:20
[MySQL] Jak usuwać wiersze z tabeli w relacji?
Author: Borneq
Date: Sat, 21 Jan 2017 18:20
Date: Sat, 21 Jan 2017 18:20
16 lines
1172 bytes
1172 bytes
Mamy tabel general: hash = primary key kod inne detail: hash+index = primary key inne z general chcemy usuwać wszystkie wiersze dla zadanego kodu: delete from general where kod=:kod teraz chcemy usunąć wszystkie wiersze z detail których hash jest równy usuwanym haszom Jak to zrobić? Select we Where czy Join ?
Re: [MySQL] Jak usuwać wiersze z tabeli w relacji?
Author: Roman Tyczka
Date: Sat, 21 Jan 2017 20:59
Date: Sat, 21 Jan 2017 20:59
14 lines
1153 bytes
1153 bytes
On Sat, 21 Jan 2017 19:20:38 +0100, Borneq wrote: > z general chcemy usuwać wszystkie wiersze dla zadanego kodu: > delete from general where kod=:kod > > teraz chcemy usunąć wszystkie wiersze z detail których hash jest równy > usuwanym haszom > Jak to zrobić? Select we Where czy Join ? trigger -- pozdrawiam Roman Tyczka
Re: [MySQL] Jak usuwać wiersze z tabeli w relacji?
Author: Borneq
Date: Sun, 22 Jan 2017 08:03
Date: Sun, 22 Jan 2017 08:03
18 lines
1370 bytes
1370 bytes
W dniu 21.01.2017 o 21:59, Roman Tyczka pisze: > On Sat, 21 Jan 2017 19:20:38 +0100, Borneq wrote: > >> z general chcemy usuwać wszystkie wiersze dla zadanego kodu: >> delete from general where kod=:kod > trigger A bez triggera jako polecenie SQL? Like delete from detail where hash = select hash from general where kod=:kod ? delete from detail left join general on detail.hash=general.hash where general.kod = :kod ?
Re: [MySQL] Jak usuwać wiersze z tabeli w relacji?
Author: geos
Date: Sun, 22 Jan 2017 09:20
Date: Sun, 22 Jan 2017 09:20
14 lines
1381 bytes
1381 bytes
On 21.01.2017 19:20, Borneq wrote: > hash = primary key > detail: > hash+index = primary key > delete from general where kod=:kod > teraz chcemy usunąć wszystkie wiersze z detail których hash jest równy > usuwanym haszom > Jak to zrobić? Select we Where czy Join ? http://www.mysqltutorial.org/mysql-on-delete-cascade/
Re: [MySQL] Jak usuwać wiersze z tabeli w relacji?
Author: Borneq
Date: Sun, 22 Jan 2017 09:46
Date: Sun, 22 Jan 2017 09:46
7 lines
1344 bytes
1344 bytes
W dniu 22.01.2017 o 10:20, geos pisze: > http://www.mysqltutorial.org/mysql-on-delete-cascade/ To jest dobre rozwiązanie o tyle, że nie zapomni się przy kasowaniu że trzeba skasować z drugiej i nie można spowodować niespójności. Ale wymaga specjalnego utworzenia tabeli, a tabele są, poza tym wymaga InnoDB, nie wiem jaki engine jest użyty na zdalnej firmowej maszynie.
Re: [MySQL] Jak usuwać wiersze z tabeli w relacji?
Author: Borneq
Date: Sun, 22 Jan 2017 10:02
Date: Sun, 22 Jan 2017 10:02
10 lines
1428 bytes
1428 bytes
W dniu 22.01.2017 o 09:03, Borneq pisze: > delete from detail where hash = select hash from general where kod=:kod delete from bitcoin.transactions_detail where tx_hash in (select tx_hash from bitcoin.transactions_general where block_height=449319) a POTEM, nie można przedtem delete from bitcoin.transactions_general where block_height=449319 Trzeba było zmienić aby nie było safe mode, dość szybko usunęło 800 wierszy ale tabele były dość pustawe.
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads