![]() |
![]() |
![]()
Post
#1
|
|
Grupa: Zarejestrowani Postów: 90 Pomógł: 0 Dołączył: 21.04.2007 Ostrzeżenie: (0%) ![]() ![]() |
Witam. Mam problem z deletem. mam takie tabele
kategoria ---------- id kategoriemarek ---------------- id kategoriaid markaid marka ------- id dane ------ id markaid
Chce usunac wszystkie dane ktore sa odpowiednie dla kategorii =1 W mysql wyskakkuje mi taki blad: ERROR 1093 (HY000): You can't specify target table 'dane' for update in FROM clause Czy ktos wie co jest zle? Prosze o odpowiedz |
|
|
![]() |
![]()
Post
#2
|
|
Grupa: Moderatorzy Postów: 36 559 Pomógł: 6315 Dołączył: 27.12.2004 ![]() |
jak komunikat glosi, nie mozesz w podzapytaniu szukac po tabeli, z ktorej wyzej kasujesz. To co ty chcesz zrobic mysle ze powinno ladnie pojsc przy uzyciu using
http://dev.mysql.com/doc/refman/5.0/en/delete.html Cytat DELETE [LOW_PRIORITY] [QUICK] [IGNORE] FROM tbl_name[.*] [, tbl_name[.*]] ... USING table_references [WHERE where_condition] Cytat DELETE FROM t1, t2 USING t1, t2, t3 WHERE t1.id=t2.id AND t2.id=t3.id;
These statements use all three tables when searching for rows to delete, but delete matching rows only from tables t1 and t2. |
|
|
![]() ![]() |
![]() |
Aktualny czas: 6.10.2025 - 00:47 |