Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> Update z Join
ShadowD
post
Post #1





Grupa: Zarejestrowani
Postów: 1 333
Pomógł: 137
Dołączył: 25.03.2008
Skąd: jesteś??

Ostrzeżenie: (0%)
-----


Mam problem z zapytaniem:

(IMG:style_emoticons/default/baaasmiley.gif)
Kod
UPDATE
games_users
SET
games_users.users_id = 0
FROM
games_users
INNER JOIN
games_teams
ON
games_teams.id = games_users.games_teams_id
WHERE
games_teams.games_id = 1 AND
games_users.users_id = 2


Jak zamiast:

Kod
UPDATE
games_users
SET
games_users.users_id = 0


Używam select *, wszystko działa tak jak powinno... Może ktoś widzi w tym jakiś błąd?

Kod
#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'FROM games_users INNER JOIN games_teams ON games_teams.id = games_users.games_te' at line 5


Rozwiązanie:

Kod
                UPDATE
                    games_users
                INNER JOIN
                    games_teams
                ON
                    games_teams.id = games_users.games_teams_id
                SET
                    games_users.users_id = null
                WHERE
                    games_teams.games_id = :idGame AND
                    games_users.users_id = :idUser


Ten post edytował ShadowD 13.02.2013, 12:39:00
Go to the top of the page
+Quote Post

Posty w temacie
- ShadowD   Update z Join   13.02.2013, 12:16:40


Reply to this topicStart new topic
2 Użytkowników czyta ten temat (2 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 3.10.2025 - 01:44