Bluehost.com Web Hosting $6.95

Trying to change column in table based on a value in another table

This is a discussion on Trying to change column in table based on a value in another table within the MySQL Database forums, part of the Database Forums category; Hey guys, I am trying to change the values in one column of one table based on the value in ...


Go Back   Usenet Forums > Database Forums > MySQL Database

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 03-27-2007
BillinBoston
 
Posts: n/a
Default Trying to change column in table based on a value in another table

Hey guys,
I am trying to change the values in one column of one table based
on the value in a different table. So far this is what i have. I am
only able to change the value based on a preset value i put into this
script. If anyone knows how I can set **value in another table** It
would be greatly appreciated.

Thanks

Bill
<?php
$con = mysql_connect("server","database","%*&^(*&(*&");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}

mysql_select_db("database", $con);


mysql_query("UPDATE data SET Column_name = 'Value'
WHERE column_name = **value in another table** ");


mysql_close($con);
?>

Reply With Quote
  #2 (permalink)  
Old 03-27-2007
Captain Paralytic
 
Posts: n/a
Default Re: Trying to change column in table based on a value in another table

On 27 Mar, 00:36, "BillinBoston" <BillinBos...@gmail.com> wrote:
> Hey guys,
> I am trying to change the values in one column of one table based
> on the value in a different table. So far this is what i have. I am
> only able to change the value based on a preset value i put into this
> script. If anyone knows how I can set **value in another table** It
> would be greatly appreciated.
>
> Thanks
>
> Bill
> <?php
> $con = mysql_connect("server","database","%*&^(*&(*&");
> if (!$con)
> {
> die('Could not connect: ' . mysql_error());
> }
>
> mysql_select_db("database", $con);
>
> mysql_query("UPDATE data SET Column_name = 'Value'
> WHERE column_name = **value in another table** ");
>
> mysql_close($con);
> ?>


There is an example of this in a special book that we call "The
Manual".

Here: http://dev.mysql.com/doc/refman/5.0/en/update.html

UPDATE items,month SET items.price=month.price
WHERE items.id=month.id;

Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT +1. The time now is 06:50 AM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0