Need Help with a SQL Query

Hello,

I’m trying to figure out how to update a specific “meta_value” (for “field_id = 179″ in the “wp_frm_item_metas table”) for each form entry submitted by a specific user (ie. item_id).  The kicker is that I need to get the proper user “item_id” in that table based on matching another “meta_value” value for (field_id = 184) (ie. an email address) …. then knowing that “item_id” I’ll need to update the meta_value for field_id = 179.

To summarize, I need to find the proper “item_id” based on matching the meta_value for field_id = 184 (ie. email address).  Then knowing that “item_id” I’ll then be able to find the meta_value for field_id = 179 – and update it with the new value.

I don’t know SQL.  But this seems to be the logic (based on me looking at the mySQL tables).

Can you help me create the SQL Update statement.

Thanks,

Mike

P.S.  The larger problem is updating the data from a CSV – but I figure first step first.

 

I don't understand well enough what you are looking for to point you in the right direction. Please take it one step at a time using multiple queries, and then you can get into more complex MySQL statements if you'd like.

Hi Stephanie,

I got a little bit of help to get this far ... can you take a look and see if there is something that I can change to make is work.

Much appreciated :)

http://stackoverflow.com/questions/11633585/updating-wordpress-mysql-db-with-data-from-csv-file-every-day-automatically

Mike

This is complex code you'll need to debug on your own or with help from a developer. However, I'd suggest changing this line to include the field id.
  $qrySel = "select * from wp_frm_items where meta_value = ".$custCode;

Topic closed.