Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> Jednoczesny update wszystkich pol rekordu
yalus
post
Post #1





Grupa: Zarejestrowani
Postów: 281
Pomógł: 0
Dołączył: 8.07.2005
Skąd: EU

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


witam

czy jest mozliwe updejtowanie wszystkich pol jednego rekordu ktore sa null przy uzyciu jednego zapytania sql


rekord sklada sie z 35 pol ale tylko niektore pola sa null np:

pole1| pole2| pole3|
'abc' | null | 'abc' |
'null' | null | 'abc' |
'abc' | 'abc' | 'null' |
'abc' | null | 'abc' |

jak teraz skonstruowac zapytanie aby realizowalo cos takiego

update tabela set pole1='' where pole1 is null, set pole2='' where pole2 is null set pole3='' where pole3 is null


pozdrawiam

Ten post edytował yalus 7.02.2007, 13:24:13
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi (1 - 6)
defrag
post
Post #2





Grupa: Zarejestrowani
Postów: 82
Pomógł: 3
Dołączył: 15.01.2007

Ostrzeżenie: (10%)
X----


  1. UPDATE tabela SET kolumna = ' ' WHERE columna = NULL
Go to the top of the page
+Quote Post
yalus
post
Post #3





Grupa: Zarejestrowani
Postów: 281
Pomógł: 0
Dołączył: 8.07.2005
Skąd: EU

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


no tak a co jak ja bym chcial updajtowac inne pola tego samego rekordu

wedlug tej reguly

update tabela set pole1='' where pole1 is null, set pole2='' where pole2 is null set pole3='' where pole3 is null

Ten post edytował yalus 7.02.2007, 13:27:55
Go to the top of the page
+Quote Post
Vogel
post
Post #4





Grupa: Zarejestrowani
Postów: 402
Pomógł: 0
Dołączył: 20.01.2003

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


  1. UPDATE ... WHERE pole1=NULL OR pole2=NULL...
Go to the top of the page
+Quote Post
yalus
post
Post #5





Grupa: Zarejestrowani
Postów: 281
Pomógł: 0
Dołączył: 8.07.2005
Skąd: EU

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


tak ale w takim przypadku

pole1| pole2| pole3|
'abc' | null | 'abc' |
'null' | null | 'abc' |
'abc' | 'abc' | 'null' |
'abc' | null | 'abc' |


to co napisales
  1. UPDATE tabela SET pole1='', pole2='', pole3='' WHERE pole1=NULL OR pole2=NULL

zaktualizuje caly rekord a mi chodzi tylko o te pola w ktorych jest null
Go to the top of the page
+Quote Post
nospor
post
Post #6





Grupa: Moderatorzy
Postów: 36 557
Pomógł: 6315
Dołączył: 27.12.2004




  1. UPDATE tabela SET pole1=ifnull(pole1,''), pole2=ifnull(pole2,''), pole3=ifnull(pole3,'')
Go to the top of the page
+Quote Post
yalus
post
Post #7





Grupa: Zarejestrowani
Postów: 281
Pomógł: 0
Dołączył: 8.07.2005
Skąd: EU

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


thx
Go to the top of the page
+Quote Post

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: 22.08.2025 - 19:53