Itworx4me Well-known member Jan 11, 2014 #1 I have a custom field named 'nick_name'. I need to query the database to find all users that don't have this field filled in. Can someone help with the sql query? Thanks, Itworx4me
I have a custom field named 'nick_name'. I need to query the database to find all users that don't have this field filled in. Can someone help with the sql query? Thanks, Itworx4me
Itworx4me Well-known member Jan 11, 2014 #2 Figured out part of the query. Now I just need to figure out how to query the table for people that don't have the field_value filled in.. Code: SELECT `user_id`, `field_id`, `field_value` FROM `xf_user_field_value` WHERE `field_id` = 'nick_name' Upvote 0 Downvote
Figured out part of the query. Now I just need to figure out how to query the table for people that don't have the field_value filled in.. Code: SELECT `user_id`, `field_id`, `field_value` FROM `xf_user_field_value` WHERE `field_id` = 'nick_name'
Itworx4me Well-known member Jan 11, 2014 #3 ok I figure out how many people don't have the field_value filled in. Code: SELECT `user_id`, `field_id`, `field_value` FROM `xf_user_field_value` WHERE `field_id` = 'nick_name' AND `field_value` ='' Now I need to update the field_value that isn't filled in with a value. How would I go about this? Upvote 0 Downvote
ok I figure out how many people don't have the field_value filled in. Code: SELECT `user_id`, `field_id`, `field_value` FROM `xf_user_field_value` WHERE `field_id` = 'nick_name' AND `field_value` ='' Now I need to update the field_value that isn't filled in with a value. How would I go about this?
Itworx4me Well-known member Jan 11, 2014 #4 Would this be the correct use of Update? Code: UPDATE `xf_user_field_value` SET `field_value`=[John Doe] WHERE `field_value` = '' Or Code: UPDATE `xf_user_field_value` SET `field_value`= John Doe WHERE `field_value` = '' Or Code: UPDATE `xf_user_field_value` SET `field_value`='John Doe' WHERE `field_value` = '' Not sure which one to use..... Last edited: Jan 11, 2014 Upvote 0 Downvote
Would this be the correct use of Update? Code: UPDATE `xf_user_field_value` SET `field_value`=[John Doe] WHERE `field_value` = '' Or Code: UPDATE `xf_user_field_value` SET `field_value`= John Doe WHERE `field_value` = '' Or Code: UPDATE `xf_user_field_value` SET `field_value`='John Doe' WHERE `field_value` = '' Not sure which one to use.....
P Paul B XenForo moderator Staff member Jan 11, 2014 #5 Code: UPDATE <table> SET <column> = REPLACE(<column>,'current_content','new_content'); Upvote 0 Downvote