PHP and mySQL...
How would I do this:
game1:
gamenum=238
homeid=10
visitorid=24
game2:
gamenum=252
homeid=22
visitorid=16
I want to switching home/visitor on the two games.
I will pass in the two game numbers. Can I do this in one query
or must i perform it in two?
Would this work for one game and if so, how could I do this
without mussing up things? Am I going to have to store values in
variables before I do this?
update games g1
set
homeid =
(
select
homeid
from
games g2
where
g2.gamenum=$firstgamenumber
)
visitorid =
(
select
visitorid
from
games g2
where
g2.gamenum=$firstgamenum
)
where
g1.gamenum = $secondgamenum