dizor
4.11.2009, 11:08:43
Jak w MySQL wykonać coś takiego:
update data set gallery = 1 where gallery = 2 and category = 4;
update data set gallery = 2 where gallery = 1 and category = 4;
Chcę zamienić wszystkie gallery = 1 na 2 , a potem 2 na 1
id:1, gallery: 1
id:2, gallery: 1
id:3, gallery: 2
id:4, gallery: 2
na
id:1, gallery: 2
id:2, gallery: 2
id:3, gallery: 1
id:4, gallery: 1
maly_swd
4.11.2009, 11:26:24
Musisz tzw zbuforowac sobie dane:)
update data set gallery = -1 where gallery = 2 and category = 4;
update data set gallery = 2 where gallery = 1 and category = 4;
update data set gallery = 2 where gallery = -1 and category = 4;
warunek pole galery musi ze znakiem:) czyli nie unsig...
mooschka
5.11.2009, 08:51:03
Cytat(dizor @ 4.11.2009, 11:08:43 )

Jak w MySQL wykonać coś takiego:
update data set gallery = 1 where gallery = 2 and category = 4;
update data set gallery = 2 where gallery = 1 and category = 4;
A ja proponuję coś takiego:
UPDATE DATA SET gallery=3-gallery WHERE category=4