tukar value dlm table mysql simple way

Posted by: fay

tukar table row dp 0 ke 1
; UPDATE distributors set country_id=1 WHERE country_id=0;

lagi cth;
UPDATE jos_users set usertype='Author' WHERE usertype='Registered';
UPDATE jos_users set gid='19' WHERE gid='18';


lagi satu how about only UPDATE record 'username' yg kosong je?
; UPDATE distributors set username=dist_code WHERE user_id > 1 AND username='';

This will update all username to match dist_code but it won't follow the
zerofill value so dist_code=0001000 will be just username=1000
; UPDATE distributors set username=dist_code where user_id > 1;


lagi satu how about only UPDATE record 'username' yg kosong je?
; UPDATE distributors set username=dist_code WHERE user_id > 1 AND username='';

This will update all username to match dist_code but it won't follow the
zerofill value so dist_code=0001000 will be just username=1000
; UPDATE distributors set username=dist_code where user_id > 1;

[ Single viewed: 6440 times (counter reset 21 Oct 2008) ]
« Prev item - Next Item »
---------------------------------------------

Comments

No comments yet. You can be the first!

Leave comment

 




Soalan bonus untuk anda
Bonus Question for yah