I had previously applied this query...which works perfectly and was answered by one of the fellow members of this forum
UPDATE
jos_jbjobs_jobseeker a
INNER JOIN jos_users b ON a.email = b.email
SET
a.user_id = b.id
Now i want to use the same query adding one more condition... ie
Set a.user_id = b.id only if a.user_id is empty ,,
can i apply this :
if a.user_id = '' SET a.user_id = b.id ;
?
UPDATE
jos_jbjobs_jobseeker a
INNER JOIN jos_users b ON a.email = b.email
SET
a.user_id = b.id
WHERE a.id IS NULL OR LENGTH(a.id)=0;
Use this
UPDATE
jos_jbjobs_jobseeker a
INNER JOIN jos_users b ON a.email = b.email
SET
a.user_id = b.id
WHERE a.id ='';
If id have null values too then use this-
UPDATE
jos_jbjobs_jobseeker a
INNER JOIN jos_users b ON a.email = b.email
SET
a.user_id = b.id
WHERE a.id is null or a.id ='';
Try this code SQL native it's work for me very well :
UPDATE table
SET field = 'New value'
WHERE field
IS NULL
OR field = ''
Update just NULL value or EMPTY .
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.