If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > MySQL > Select/Update selection problem

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 02-24-09, 11:23
oldnickj oldnickj is offline
Registered User
 
Join Date: Jan 2009
Posts: 103
Select/Update selection problem

My challenge is to insert the email address in the username_usr field if username field is empty.

The first query returns no rows

SELECT username_usr, EMail
FROM CBA
WHERE username_usr IS NULL

This one does return rows

SELECT username_usr, EMail
FROM CBA
WHERE EMAIL IS NOT NULL

This affects no rows yet there are a number of cases where there is an EMAil and username_usr id empty. FIeld types are identical!

UPDATE CBA SET username_usr = EMail
WHERE username_usr IS NULL


Nick
Reply With Quote
  #2 (permalink)  
Old 02-24-09, 12:06
guelphdad guelphdad is offline
Registered User
 
Join Date: Mar 2004
Posts: 440
NULL and empty are not the same thing check for username_user=''
Reply With Quote
  #3 (permalink)  
Old 02-24-09, 12:22
oldnickj oldnickj is offline
Registered User
 
Join Date: Jan 2009
Posts: 103
Thanks, i'd forgotten

Nick
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On