How can I update query joining multiple tables.

Hi team,

I want to update a column of TABLE 1, but it should rally with TABLE 2. Under certain conditions, that it should be updated.

I created as below. But it does not work.

Can you please suggest me how can I do?

UPDATE Table1
SET Table1.Column1 = 'name'
FROM Table1 T1, Table2 T2
WHERE T1.id = T2.id
and T1.name  = T2.Name
And T1.id = UPDATE Table1
  SET Table1.Column1 = 'name'
FROM Table1 T1, Table2 T2
WHERE T1.id = T2.id
and T1.id = '100';


Hello

Your update statement is not at all clear.

Something like below:

UPDATE Table1 T1

THE T1 VALUE. Column1 = 'name '.

WHERE EXISTS (SELECT 1 FROM Table2 T2 WHERE)

T1.ID = T2.id and T1.name = T2. (Name);

(Or)

UPDATE Table1 T1

THE T1 VALUE. Column1 = 'name '.

WHERE EXISTS (SELECT 1 FROM Table2 T2 WHERE)

T1.ID = T2.id and T1.name = T2. The name) and T1.id = '100';

Tags: Database

Similar Questions

  • How can I update the data in mysql using the button defined in the table?

    Hello

    right now I am doing my project for the online election system using dreamweaver cc14. I create a table using php code to bind the data to mysql, and in this painting, I create also a button "vote" for voters to vote. My question is, how can I update my polling data in the mysql database when voters push button "vote" based on the id of the candidates? Here is my code I try:

    <form method="post" id="form1">
          <?php
    $servername = "localhost";
    $username = "root";
    $password = "pass";
    $dbname = "ses";
    
    
    // Create connection
    $conn = new mysqli($servername, $username, $password, $dbname);
    // Check connection
    if ($conn->connect_error) {
         die("Connection failed: " . $conn->connect_error);
    } 
    
    
    $sql = "SELECT No, Calon, ID, Jurusan, Image FROM candidates";
    $result = $conn->query($sql);
    
    
    if ($result->num_rows > 0) {
         echo "<table >
      <tr>
      <th>NO</th>
      <th>Candidate</th>
      <th>INFO</th>
      <th>Vote</th>
      </tr>";
         // output data of each row
         while($row = $result->fetch_assoc()) {
             echo "<tr>
      <td>" . $row["No"]. "</td>
      <td><img src=" . $row['Image'] . "></td>
      <td><br/>-" . $row["Calon"]. " <br/>-" . $row["ID"]. " <br/>-" . $row["Jurusan"]. "<br/></td>
      <td><input type="."submit"." name=".$row["Calon"]." id=".$row["No"]. " value="."Vote"."></td>
    
      </tr>";
      if(isset($_POST["".$row['No'].""])){
    
      $vote_sachin = "UPDATE candidates SET Undi=Undi+1 WHERE No=".$row["No"]. "";
    
      $run_sachin = mysqli_query($conn, $vote_sachin);
    
    
    }
        }
      echo "</table>";
    } else {
         echo "0 results";
    }
    
    
    
    
    
    
    $conn->close();
    ?>
    
    
    
    
        </form>
    

    I hope someone can help me in this area, because I'm still new in this programming language.

    Thank you.

    Youre probably going to insert a 'radio button' next to the names of candidates and recover the database ID of that (I guess that the ID is the primary key in your database that uniquely identifies each record.

    His great confusion because you seem to update the database to aid WHERE no = "." $row ["no"]. so I don't know that ID is the primary key?

    IF "No" IS your master database key, you need to change the code below:

    TO:

    Here's the complete code based on the ID of your primary database key.

    <>

    $servername = "localhost";

    $username = 'root ';

    $password = "pass";

    $dbname = 'his ';

    Create the connection

    $conn = new mysqli ($dbname, $servername, $username, $password);

    Check the connection

    If {($conn-> connect_error)

    Die ("connection failed:".) $conn-> connect_error);

    }

    $sql = "SELECT No, Calon, ID, Jurusan, Image OF candidates";

    $result = $conn-> Query;

    If you click on the button "vote" form run the code to update the database below

    {if (isset($_POST['vote']))}

    Get the value of the ID of the radio button form field and store it in a table.

    $update_vote = $_POST ['candidate_id'];

    loop in the table and update the database

    foreach ($update_vote as $value) {}

    $vote_sachin = ' candidates UPDATE SET Undi = Undi + 1 WHERE ID = ".". " $value. » « ;"

    $run_sachin = mysqli_query ($conn, $vote_sachin);

    }

    }

    ?>

    <>

    If ($result-> num_rows > 0) {}

    ECHO '.

    ";

    each line output

    While ($row = {$result-> fetch_assoc())}

    ECHO '.

    ";

    }

    ECHO '.

    ";

    ECHO '.

    NO. Candidate INFO To the vote
    " . $row ["no"]. "
    -" . $row ["Calon"]. "
    -" . $row ['ID']. "
    -" . $row ["Jurusan"]. "
    ";

    } else {}

    echo "0 results."

    }

    $conn-> close();

    ?>

  • I have Microsoft Money 2006 how can I update and keep the info?

    I have Microsoft Money 2006 how can I update and keep the info?

    Hi NRHand7,

    Microsoft has stopped selling money on June 30, 2009. The last activation of version (more Money, or money 2008) required in order to be fully functional.

    For more information, you can consult the following articles:

    What is Microsoft Money Plus sunset?

    Money Solution Center

    We can refer to the following articles and check if it helps.

    How to export and import account information in Microsoft Money

    How to remove and reinstall Microsoft Money

    You can also post your query in Microsoft Money Forum to get help.

    Microsoft Money

    Hope this information is useful.

  • How can I update the gps of streets &amp; trips

    How can I update the gps of streets & trips (not sure which version)

    Hi CP agent v-2jeen

     

    Because the question is specific to the streets and trips you contact that it can support the assistance team. I would recommend posting your query to the community of Microsoft streets & trips. Please visit the links below to find a community that will support what ask you in the right direction.

    http://social.Microsoft.com/forums/en-us/streetsandtrips/threads

    You can also check out below help links-
    http://support.Microsoft.com/ph/1058#TAB0
    http://www.Microsoft.com/streets/en-us/support-and-training.aspx

    I hope this helps.

  • Please how can I update my system drivers?

    Please how can I update my driver:

    Name Mobile Intel (r) 915GM/GMS, 910GML Express Chipset Family
    ID of device PNP PCI VEN_8086 & DEV_2592 & SUBSYS_207117C0 & REV_04\3 & 61AAA01 & 0 & 10
    Adapter Type Intel (r) 915GM/GMS, 910GML Express Chipset, Intel Corporation compatible
    Description of the card Mobile Intel (r) 915GM/GMS, 910GML Express Chipset Family
    Adapter RAM 96.00 MB (100,663,296 bytes)
    Ialmrnt5.dll of installed drivers
    6.14.10.4291 driver version
    File INF oem0.inf (section iALV0)
    Color plans 1
    4294967296 colors Table entries
    Resolution 1280 x 800 x 60 hertz
    32 bits/Pixel
    0xB0080000-0xB00FFFFF memory address
    IO port 0 x 00001800 - 0 x 00001807
    0xC0000000-0xCFFFFFFF memory address
    0xB0040000-0xB007FFFF memory address
    IRQ channel, IRQ 16
    Port of e/s-0x000003B0-0x000003BB
    Port of e/s-0x000003C0-0x000003DF
    Address 0xA0000-0xBFFFF
    Name Mobile Intel (r) 915GM/GMS, 910GML Express Chipset Family
    ID of device PNP PCI VEN_8086 & DEV_2792 & SUBSYS_207117C0 & REV_04\3 & 61AAA01 & 0 & 11
    Adapter Type Intel (r) 915GM/GMS, 910GML Express Chipset, Intel Corporation compatible
    Description of the card Mobile Intel (r) 915GM/GMS, 910GML Express Chipset Family
    Adapter RAM 96.00 MB (100,663,296 bytes)
    Ialmrnt5.dll of installed drivers
    6.14.10.4291 driver version
    File INF oem0.inf (section iALV1)
    Color of the aircraft not available
    Color not available Table entries
    No available resolution
    Bits/Pixel is not available
    0xFAB00000-0xFAB7FFFF memory address
    Thanks in advance

    Go to: http://www.intel.com

    Locate 'support', search for "drivers/software", in the new window, locate

    'chipset software', select the 'chipset installation utility", also, typeRegeditdans

    Search, youre chipset model number, they can have Add-ons...

  • How can I update my iPhone more than 8.4 of iOS iOS 9.3.5 6?

    How can I update my iPhone more than 8.4 of iOS iOS 9.3.5 6?

    You do not have. You can only upgrade to the current version which is 10.0.2

  • I forgot the answer to my security question, I tried to update these answers, but to update them also, I must first answers old issue of security which I forgot how can I update and change my security question and the answers?

    I forgot the answer to my security question, I tried to update these answers, but to update them also, I must first answers old issue of security which I forgot how can I update and change my security question and the answers

    ?

    You must ask security team account Apple to reset your security questions. To contact them, click here and choose a method; If this page does not list one for your country or if you are unable to call, complete and submit this form.

    (143315)

  • How can I update my iPad 2 to 4G to work

    How can I update my iPad 2 wifi / 3G to 4G to work

    If you mean speed 4 G, I doubt that it's sort of, unless the Dock Connector to USB would be able to use an auxiliary device of Wifi.

  • How can I update iMovie?

    After the update to El Capitan the iMovie app does not work with my old photos to iPhoto. They have partially disappeared from films. How to re - import the pix missing with new PHOTOS of the app to iMovie? How can I update iMovie? Same problem with GarageBand. Thank you, people of a response. Micha

    Version 8 iMovie is not compatible with El Capitan, so you must upgrade to iMovie 10.1.2. To connect to the App Store and look under the purchased Tab. Find iMovie and Garage Band. If they are not there, it may be that the free updates are not available in iMovie 8. I'm not sure about this. They are free to version 9. You can also go to your account and make sure iMovie is not hidden.

  • Hi, I just bought a used 2012 Pro 13 "Macbook. It came with iMovie installed. However, I would like to get the update to iMovie. He said: I can't update iMovie because a different Apple ID was used to download iMovie and I get errors. How can I update iMo

    Hi, I just bought a used 2012 Pro 13 "Macbook. It came with iMovie installed. However, I would like to get the update to iMovie. He said: I can't update iMovie because a different Apple ID was used to download iMovie and I get errors. How can I update iMovie?

    Error message #1: these applications cannot be accepted by your Apple ID. These applications have already been assigned to another Apple ID, and they will be available in this list of purchases Apple ID. If you don't have access to this Apple ID and would like to receive future updates, you will need to purchase applications.

    Error message #2: update are not available with this Apple ID. This update is not available for this Apple ID either because it was bought by another user or the item has been refunded or cancelled.

    Error message #3: we could not complete your request. There was an error in the App Store. Please try again later. (null)

    Unfortunately, free updates are available to the original purchaser of the computer. The iMovie is locked to his Apple ID, so unless you have to grab his ID, you can buy iMovie.

  • How can I update OSX 10.5.8?

    How can I update OSX 10.5.8?

    The system version: Mac OS X 10.5.8 (9L31a)

    Kernel version: Darwin 9.8.0

    Model name: MacBook Pro

    Model ID: MacBookPro5, 2

    Processor name: Intel Core 2 Duo

    Processor speed: of 2.66 GHz

    Number of processors: 1

    Total number of cores: 2

    L2 Cache: 6 MB

    Memory: 4 GB

    Bus speed: 1.07 GHz

    Boot ROM version: MBP52.008E.B05

    Version of the SCM (System): 1.42f4

    Your Mac should do a Mid/Late 2007 or newer) model to upgrade to the new OS X currently available > OS X El Capitan - technical specifications

    If your Mac meets the demands of El Capitan, you can always buy a disc of Snow Leopard 10.6.

    10.6.8 installed, you access to the App Store to download El Capitan.

  • Satellite L300D - 24 d how can I update the graphics driver?

    Hello

    How can I update the driver for my ATI Radeon 3100 graphics card. (Win Vista 32 bit)
    I download and installed the new ATI Catalyst worms. 10.12.

    If I change my graphics card options, there is always the old driver installed... Worms. 22.04.08 8.479.0.0
    Also, it is not possible to change the settings for graphic resolution higher than 1280 X 800 Pix.

    Thanks for the help,

    Fun1975

    First, you must use the page to Toshiba display driver.
    The use of other drivers can lead to highest GPU temperature and cause overheating.

    But if you want to use other drivers, you can do so at you own risk.
    In order to install another driver, go to Device Manager, mark the graphics card, then press on uninstall button.
    Then the driver should be uninstalled.

    After you restart the laptop, you can try to install the new version.

    > It is also not possible to change the settings for graphic resolution higher than 1280 X 800 Pix.
    The internal screen for laptop supports 1280 x 800 high resolution. It is not possible to choose a higher value.

  • How can I update Tiger operating system without an administrator password?

    I got an iMac using OS Tiger, last updated in 2010. I did not have the administrator password and have not been able to find out what it is. How can I update software?

    You can not. You need to get the original Mac OS X shipped with this computer. Contact Apple to order. Make sure that you have the serial number of the computers and the ID of the model practice before calling:

    Apple Store Customer Service at the the 1-800-676-2775 or see the online help for more information.

    Contact product support and tech: Contacting Apple for support and service - this includes

    numbers of international calls...

    Mac App Store: Apple - Support - Mac App Store.

    For iTunes: Apple - Support - iTunes.

    Writing an effective question of communities of Apple Support

  • you want to watch netflix on my tv but the sound telling me that I have to update how can I update my TV

    you want to watch netflix on my tv but the sound telling me that I have to update how can I update my TV

    How to upgrade sony TV

  • HP slate 6 voice tab: How can I update my software of voice 6 HP slate of Marshmallow tab?

    I use 6 HP slate voice tab and want to upgrade the current android software Marshmallow. Please advise how can I update?

    Hello and welcome to the HP support community!

    Unfortunately, HP does not provide a way to upgrade to Android version 6.x.

    If you want to take the risk of permanently damage the unit, try searching for 'slate voice tab upgrade Marshmallow' Google... This creates a lot of success.  (Make your own choices.  HP does not recommend this).

    WyreNut

Maybe you are looking for