Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

 
Reply to this topicStart new topic
> 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:

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


--------------------
Mój blog - o wszystkim i niczym ale zazwyczaj związane z informatyką! ;-)
Githube

Usługi spawalnicze i monterskie | Park linowy Lublin i Okunince
Go to the top of the page
+Quote Post

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

 



RSS Aktualny czas: 20.08.2025 - 07:43