Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
richm
Starting Member
2 Posts |
Posted - 2008-07-31 : 11:20:41
|
| Hello everyone. This is my first post. I was really glad to find this forum. I have been reading through the threads and there are A LOT of great tips here. I am brand new to SQL, took a one-week class that my company paid for, but I am having some trouble structuring what is probably a fairly simple query. I am familiar with UPDATE and SELECT and JOIN, but can't quite get the formatting right to do an Update of records in one table based upon fields in another table.For instance, I want to update fields in a jos_vm_user_info table from fields in the jos_comprofiler table based upon a matched user_id, and an address_type of "BT":UPDATE jos_vm_user_info->address_1 = jos_comprofiler->cb_address jos_vm_user_info->state = jos_comprofiler->cb_stateFOR jos_vm_user_info->user_id = jos_comprofiler->user_id AND jos_vm_user_info->address_type = 'BT' AND jos_vm_user_info->address_1 is blank or nullI need to run this query for all records once, but then I need to add the query to a PHP program to update new records, so I need a current record and an all records version.Are there any SQL gurus out there who can help me re-structure this in to a QUERY? |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-07-31 : 12:43:59
|
| aAre you using MS SQL Server? |
 |
|
|
richm
Starting Member
2 Posts |
Posted - 2008-07-31 : 20:15:14
|
| No, this is for MySQL. However, my training was on Microsoft SQL Server, and I have learned some of the differences but not all. |
 |
|
|
|
|
|