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... i.e
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With