{"id":1595,"date":"2012-12-29T10:00:06","date_gmt":"2012-12-29T15:00:06","guid":{"rendered":"http:\/\/sqlity.net\/en\/?p=1595"},"modified":"2014-11-13T13:49:43","modified_gmt":"2014-11-13T18:49:43","slug":"a-join-a-day-update-delete","status":"publish","type":"post","link":"https:\/\/sqlity.net\/en\/1595\/a-join-a-day-update-delete\/","title":{"rendered":"A Join A Day \u2013 UPDATE &#038; DELETE"},"content":{"rendered":"<div>\n<h3>Introduction<\/h3>\n<p>\nThis is the twenty-ninth post in my <a href=\"http:\/\/sqlity.net\/en\/1146\/a-join-a-day-introduction\/\">A Join A Day<\/a> series about SQL Server Joins. Make sure to let me know how I am doing or ask your burning join related questions by leaving a comment below.\n<\/p>\n<p>\nUp to now all articles in this series looked at queries written to retrieve data with the <span class=\"tt\">SELECT<\/span> statement. Today and tomorrow we are going to look at ways to change data while using information in more than one table.\n<\/p>\n<h3>UPDATE &amp; DELETE Join Examples<\/h3>\n<p>\nLet's assume our order system contained a bug and messed up some orders. The orders are easily identifiable as they have a <span class=\"tt\">Status<\/span> value of <span class=\"tt\">8<\/span> on the <span class=\"tt\">Sales.SalesOrderHeader<\/span> table. For all items in <span class=\"tt\">Sales.SalesOrderDetail<\/span> that are part of those orders we need to reduce the quantity by a factor of 10. If we want to write a <span class=\"tt\">SELECT<\/span> statement to see those orders and their correct quantities we would use this join statement:\n<\/p>\n<div>\n[sql]\nSELECT  sod.SalesOrderID,<br \/>\n        OrderQty = sod.OrderQty * 0.1<br \/>\nFROM    Sales.SalesOrderHeader AS soh<br \/>\nJOIN    Sales.SalesOrderDetail AS sod<br \/>\n        ON soh.SalesOrderID = sod.SalesOrderID<br \/>\nWHERE   soh.Status = 8;<br \/>\n[\/sql]\n<\/div>\n<p>\nFor each order with <span class=\"tt\">Status = 8<\/span> it calculates and returns the tenth part of the quantity of each item.\n<\/p>\n<p>\nTo turn this into an update statement we just need to switch out the <span class=\"tt\">SELECT<\/span> line like this:\n<\/p>\n<div>\n[sql]\nUPDATE  sod SET<br \/>\n        OrderQty = sod.OrderQty * 0.1<br \/>\nFROM    Sales.SalesOrderHeader AS soh<br \/>\nJOIN    Sales.SalesOrderDetail AS sod<br \/>\n        ON soh.SalesOrderID = sod.SalesOrderID<br \/>\nWHERE   soh.Status = 8;<br \/>\n[\/sql]\n<\/div>\n<p>\nThis will now update the rows in the <span class=\"tt\">Sales.SalesOrderDetail<\/span> that have a status of 8 in the <span class=\"tt\">Sales.SalesOrderHeader<\/span> table. The join itself is exactly the same as in the <span class=\"tt\">SELECT<\/span> query. The <span class=\"tt\">UPDATE<\/span> references the <span class=\"tt\">sod<\/span> table alias that is defined for the <span class=\"tt\">Sales.SalesOrderDetail<\/span> table, to indicate that we want to update records in that table.\n<\/p>\n<p>\nAfter running that statement we notice that the <span class=\"tt\">Status = 8<\/span> records are not actually of wrong quantity. Instead they were invented by the system and now need to be removed. For that we can again use the same query, we just need to replace the first line with a <span class=\"tt\">DELETE<\/span> like this:\n<\/p>\n<div>\n[sql]\nDELETE  sod<br \/>\nFROM    Sales.SalesOrderHeader AS soh<br \/>\nJOIN    Sales.SalesOrderDetail AS sod<br \/>\n        ON soh.SalesOrderID = sod.SalesOrderID<br \/>\nWHERE   soh.Status = 8;<br \/>\n[\/sql]\n<\/div>\n<p>\nThis takes care of the <span class=\"tt\">Sales.SalesOrderDetail<\/span> records for those \"invented\" orders. To also remove the <span class=\"tt\">Sales.SalesOrderHeader<\/span> you would have to execute a separate <span class=\"tt\">DELETE<\/span> just against that table, but we are going to skip that step today.\n<\/p>\n<p>\nAgain, the actual join part of the query did not change.  Like the <span class=\"tt\">UPDATE<\/span>, the <span class=\"tt\">DELETE<\/span> is referencing the <span class=\"tt\">sod<\/span> alias defined in the join to indicate which table to delete from.\n<\/p>\n<h3> UPDATE &amp; DELETE Join Syntax<\/h3>\n<p>\nBoth <span class=\"tt\">UPDATE<\/span> and <span class=\"tt\">DELETE<\/span> allow you to specify a <span class=\"tt\">FROM<\/span> clause. That <span class=\"tt\">FROM<\/span> clause can be followed by almost anything that you can put behind the <span class=\"tt\">FROM<\/span> keyword in a <span class=\"tt\">SELECT<\/span> statement. Each table referenced by this <span class=\"tt\">FROM<\/span> clause should have its own alias. The table to actually update needs to be referenced directly after the <span class=\"tt\">UPDATE<\/span> keyword using its alias, not the table name itself. This is not the only way to reference multiple tables in an update statement, however this way tends to be the one that is the easiest to read and that is the easiest to get right.\n<\/p>\n<p>\nYou might have noticed that the second line of the <span class=\"tt\">SELECT<\/span> statement is using an uncommon syntax:<span class=\"tt\">OrderQty = sod.OrderQty * 0.1<\/span>. This is an alternative to specifying the column alias name after the value using the <span class=\"tt\">AS<\/span> keyword. I like to use it when working on a <span class=\"tt\">SELECT<\/span> that might be used in an <span class=\"tt\">UPDATE<\/span> query, as it allows me to just switch out the first line of the <span class=\"tt\">SELECT<\/span> statement. This requires that the target column name is used as alias for each value.\n<\/p>\n<p>\nUsing SQL Server, all <span class=\"tt\">UPDATE<\/span> or <span class=\"tt\">DELETE<\/span> statements can only change data in one table. If you need to update rows in more than one table, you need to write a separate statement for each of them. Other database management systems like MySQL allow for multiple tables to be changed within one statement. If you have to port code like that to T-SQL you need to separate those changes out.\n<\/p>\n<h3> UPDATE &amp; DELETE Operators<\/h3>\n<p>\nThe above <span class=\"tt\">SELECT<\/span> query has this execution plan:\n<\/p>\n<p>\n<a href=\"http:\/\/sqlity.net\/wp-content\/uploads\/2012\/12\/simple-select-query.jpg\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/sqlity.net\/wp-content\/uploads\/2012\/12\/simple-select-query.jpg\" alt=\"a simple select query\" title=\"a simple select query\" width=\"1093\" height=\"573\" class=\"aligncenter size-full wp-image-1598\" srcset=\"https:\/\/sqlity.net\/wp-content\/uploads\/2012\/12\/simple-select-query.jpg 1093w, https:\/\/sqlity.net\/wp-content\/uploads\/2012\/12\/simple-select-query-300x157.jpg 300w, https:\/\/sqlity.net\/wp-content\/uploads\/2012\/12\/simple-select-query-1024x536.jpg 1024w, https:\/\/sqlity.net\/wp-content\/uploads\/2012\/12\/simple-select-query-150x78.jpg 150w\" sizes=\"auto, (max-width: 1093px) 100vw, 1093px\" \/><\/a>\n<\/p>\n<p>\nThe same execution plan is used to identify the rows to update in the <span class=\"tt\">UPDATE<\/span> query, feeding rows to the actual update logic:\n<\/p>\n<p>\n<a href=\"http:\/\/sqlity.net\/wp-content\/uploads\/2012\/12\/update-join-query.jpg\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/sqlity.net\/wp-content\/uploads\/2012\/12\/update-join-query.jpg\" alt=\"update join query\" title=\"update join query\" width=\"1920\" height=\"1138\" class=\"aligncenter size-full wp-image-1596\" srcset=\"https:\/\/sqlity.net\/wp-content\/uploads\/2012\/12\/update-join-query.jpg 1920w, https:\/\/sqlity.net\/wp-content\/uploads\/2012\/12\/update-join-query-300x177.jpg 300w, https:\/\/sqlity.net\/wp-content\/uploads\/2012\/12\/update-join-query-1024x606.jpg 1024w, https:\/\/sqlity.net\/wp-content\/uploads\/2012\/12\/update-join-query-150x88.jpg 150w\" sizes=\"auto, (max-width: 1920px) 100vw, 1920px\" \/><\/a>\n<\/p>\n<p>\nDepending on the columns updated, the <span class=\"tt\">UPDATE<\/span> execution plan might contain additional operators to enforce constraints (as the Assert operator in this plan) or to prevent the same row from being updated more than once. That might cause the select portion of the plan to change. For example another join algorithm might be used in some cases. In general however you will see the same plan being part of the <span class=\"tt\">UPDATE<\/span> query's execution plan.\n<\/p>\n<p>\nThe same is true for the <span class=\"tt\">DELETE<\/span> query:\n<\/p>\n<p>\n<a href=\"http:\/\/sqlity.net\/wp-content\/uploads\/2012\/12\/delete-join-query.jpg\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/sqlity.net\/wp-content\/uploads\/2012\/12\/delete-join-query.jpg\" alt=\"delete join query\" title=\"delete join query\" width=\"1920\" height=\"1138\" class=\"aligncenter size-full wp-image-1597\" srcset=\"https:\/\/sqlity.net\/wp-content\/uploads\/2012\/12\/delete-join-query.jpg 1920w, https:\/\/sqlity.net\/wp-content\/uploads\/2012\/12\/delete-join-query-300x177.jpg 300w, https:\/\/sqlity.net\/wp-content\/uploads\/2012\/12\/delete-join-query-1024x606.jpg 1024w, https:\/\/sqlity.net\/wp-content\/uploads\/2012\/12\/delete-join-query-150x88.jpg 150w\" sizes=\"auto, (max-width: 1920px) 100vw, 1920px\" \/><\/a>\n<\/p>\n<p>\nIt also contains the <span class=\"tt\">SELECT<\/span> query's execution plan (minus the calculation of the new quantity value) as the part to identify the rows that need to be removed.\n<\/p>\n<p>\nThe <span class=\"tt\">DELETE<\/span> execution plan in this example ended up being an \"index at a time\" execution plan. Both <span class=\"tt\">UPDATE<\/span> and <span class=\"tt\">DELETE<\/span> queries can be either \"row at a time\" or \"index at a time\". In the \"row at a time\" mode the main update\/delete operator takes care of all indexes for each row at the time the row is changed. In the \"index at a time\" mode however, the main operator only changes the base table. The indexes are then updated on at a time afterwards.\n<\/p>\n<h3>Summary<\/h3>\n<p>\nThe T-SQL language allows us to use the same powerful join syntax that the <span class=\"tt\">SELECT<\/span> statement offers to identify the rows that need to be changed in <span class=\"tt\">UPDATE<\/span> as well as <span class=\"tt\">DELETE<\/span> statements. While those queries can lead to totally different execution plans, often we see the same execution plan that the matching <span class=\"tt\">SELECT<\/span> statement produced being part of the modification execution plan as well.\n<\/p>\n<h3>A Join A Day<\/h3>\n<p>\nThis post is part of my December 2012 \"A Join A Day\" blog post series. You can find the table of contents with all posts published so far in the introductory post: <a href=\"http:\/\/sqlity.net\/en\/1146\/a-join-a-day-introduction\/\">A Join A Day \u2013 Introduction<\/a>. Check back there frequently throughout the month.\n<\/p>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>Do you need to pull in data from several tables to update just one? This post shows how a join can be incorporated in an update or delete statement.<\/p>\n<p> <a href=\"https:\/\/sqlity.net\/en\/1595\/a-join-a-day-update-delete\/\">[more&#8230;]<\/a><\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2},"jetpack_post_was_ever_published":false},"categories":[28,5,27,23],"tags":[],"class_list":["post-1595","post","type-post","status-publish","format-standard","hentry","category-a-join-a-day","category-general","category-series","category-t-sql-statements"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.8 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>A Join A Day \u2013 UPDATE &amp; DELETE - sqlity.net<\/title>\n<meta name=\"description\" content=\"Do you need to pull in data from several tables to update just one? This post shows how a join can be incorporated in an update or delete statement.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/sqlity.net\/en\/1595\/a-join-a-day-update-delete\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"A Join A Day \u2013 UPDATE &amp; DELETE - sqlity.net\" \/>\n<meta property=\"og:description\" content=\"Do you need to pull in data from several tables to update just one? This post shows how a join can be incorporated in an update or delete statement.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/sqlity.net\/en\/1595\/a-join-a-day-update-delete\/\" \/>\n<meta property=\"og:site_name\" content=\"sqlity.net\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/sqlity.net\" \/>\n<meta property=\"article:published_time\" content=\"2012-12-29T15:00:06+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2014-11-13T18:49:43+00:00\" \/>\n<meta property=\"og:image\" content=\"http:\/\/sqlity.net\/wp-content\/uploads\/2012\/12\/simple-select-query.jpg\" \/>\n<meta name=\"author\" content=\"Sebastian Meine\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@sqlity\" \/>\n<meta name=\"twitter:site\" content=\"@sqlity\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Sebastian Meine\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"6 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/sqlity.net\\\/en\\\/1595\\\/a-join-a-day-update-delete\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/sqlity.net\\\/en\\\/1595\\\/a-join-a-day-update-delete\\\/\"},\"author\":{\"name\":\"Sebastian Meine\",\"@id\":\"https:\\\/\\\/sqlity.net\\\/en\\\/#\\\/schema\\\/person\\\/bcffd8c572bc2f1bd10fdba80135e53c\"},\"headline\":\"A Join A Day \u2013 UPDATE &#038; DELETE\",\"datePublished\":\"2012-12-29T15:00:06+00:00\",\"dateModified\":\"2014-11-13T18:49:43+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/sqlity.net\\\/en\\\/1595\\\/a-join-a-day-update-delete\\\/\"},\"wordCount\":1162,\"commentCount\":0,\"image\":{\"@id\":\"https:\\\/\\\/sqlity.net\\\/en\\\/1595\\\/a-join-a-day-update-delete\\\/#primaryimage\"},\"thumbnailUrl\":\"http:\\\/\\\/sqlity.net\\\/wp-content\\\/uploads\\\/2012\\\/12\\\/simple-select-query.jpg\",\"articleSection\":[\"A Join A Day\",\"General\",\"Series\",\"T-SQL Statements\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/sqlity.net\\\/en\\\/1595\\\/a-join-a-day-update-delete\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/sqlity.net\\\/en\\\/1595\\\/a-join-a-day-update-delete\\\/\",\"url\":\"https:\\\/\\\/sqlity.net\\\/en\\\/1595\\\/a-join-a-day-update-delete\\\/\",\"name\":\"A Join A Day \u2013 UPDATE & DELETE - sqlity.net\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/sqlity.net\\\/en\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/sqlity.net\\\/en\\\/1595\\\/a-join-a-day-update-delete\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/sqlity.net\\\/en\\\/1595\\\/a-join-a-day-update-delete\\\/#primaryimage\"},\"thumbnailUrl\":\"http:\\\/\\\/sqlity.net\\\/wp-content\\\/uploads\\\/2012\\\/12\\\/simple-select-query.jpg\",\"datePublished\":\"2012-12-29T15:00:06+00:00\",\"dateModified\":\"2014-11-13T18:49:43+00:00\",\"author\":{\"@id\":\"https:\\\/\\\/sqlity.net\\\/en\\\/#\\\/schema\\\/person\\\/bcffd8c572bc2f1bd10fdba80135e53c\"},\"description\":\"Do you need to pull in data from several tables to update just one? This post shows how a join can be incorporated in an update or delete statement.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/sqlity.net\\\/en\\\/1595\\\/a-join-a-day-update-delete\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/sqlity.net\\\/en\\\/1595\\\/a-join-a-day-update-delete\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/sqlity.net\\\/en\\\/1595\\\/a-join-a-day-update-delete\\\/#primaryimage\",\"url\":\"http:\\\/\\\/sqlity.net\\\/wp-content\\\/uploads\\\/2012\\\/12\\\/simple-select-query.jpg\",\"contentUrl\":\"http:\\\/\\\/sqlity.net\\\/wp-content\\\/uploads\\\/2012\\\/12\\\/simple-select-query.jpg\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/sqlity.net\\\/en\\\/1595\\\/a-join-a-day-update-delete\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/sqlity.net\\\/en\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"A Join A Day \u2013 UPDATE &#038; DELETE\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/sqlity.net\\\/en\\\/#website\",\"url\":\"https:\\\/\\\/sqlity.net\\\/en\\\/\",\"name\":\"sqlity.net\",\"description\":\"Quality for SQL\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/sqlity.net\\\/en\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/sqlity.net\\\/en\\\/#\\\/schema\\\/person\\\/bcffd8c572bc2f1bd10fdba80135e53c\",\"name\":\"Sebastian Meine\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/4ab0a6d02dd494849a584a2c3c8bc3bdcef1d0aa5f87e98bf905dbdb9ad2ce3a?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/4ab0a6d02dd494849a584a2c3c8bc3bdcef1d0aa5f87e98bf905dbdb9ad2ce3a?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/4ab0a6d02dd494849a584a2c3c8bc3bdcef1d0aa5f87e98bf905dbdb9ad2ce3a?s=96&d=mm&r=g\",\"caption\":\"Sebastian Meine\"},\"sameAs\":[\"http:\\\/\\\/sqlity.net\",\"https:\\\/\\\/x.com\\\/sqlity\"]}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"A Join A Day \u2013 UPDATE & DELETE - sqlity.net","description":"Do you need to pull in data from several tables to update just one? This post shows how a join can be incorporated in an update or delete statement.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/sqlity.net\/en\/1595\/a-join-a-day-update-delete\/","og_locale":"en_US","og_type":"article","og_title":"A Join A Day \u2013 UPDATE & DELETE - sqlity.net","og_description":"Do you need to pull in data from several tables to update just one? This post shows how a join can be incorporated in an update or delete statement.","og_url":"https:\/\/sqlity.net\/en\/1595\/a-join-a-day-update-delete\/","og_site_name":"sqlity.net","article_publisher":"https:\/\/www.facebook.com\/sqlity.net","article_published_time":"2012-12-29T15:00:06+00:00","article_modified_time":"2014-11-13T18:49:43+00:00","og_image":[{"url":"http:\/\/sqlity.net\/wp-content\/uploads\/2012\/12\/simple-select-query.jpg","type":"","width":"","height":""}],"author":"Sebastian Meine","twitter_card":"summary_large_image","twitter_creator":"@sqlity","twitter_site":"@sqlity","twitter_misc":{"Written by":"Sebastian Meine","Est. reading time":"6 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/sqlity.net\/en\/1595\/a-join-a-day-update-delete\/#article","isPartOf":{"@id":"https:\/\/sqlity.net\/en\/1595\/a-join-a-day-update-delete\/"},"author":{"name":"Sebastian Meine","@id":"https:\/\/sqlity.net\/en\/#\/schema\/person\/bcffd8c572bc2f1bd10fdba80135e53c"},"headline":"A Join A Day \u2013 UPDATE &#038; DELETE","datePublished":"2012-12-29T15:00:06+00:00","dateModified":"2014-11-13T18:49:43+00:00","mainEntityOfPage":{"@id":"https:\/\/sqlity.net\/en\/1595\/a-join-a-day-update-delete\/"},"wordCount":1162,"commentCount":0,"image":{"@id":"https:\/\/sqlity.net\/en\/1595\/a-join-a-day-update-delete\/#primaryimage"},"thumbnailUrl":"http:\/\/sqlity.net\/wp-content\/uploads\/2012\/12\/simple-select-query.jpg","articleSection":["A Join A Day","General","Series","T-SQL Statements"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/sqlity.net\/en\/1595\/a-join-a-day-update-delete\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/sqlity.net\/en\/1595\/a-join-a-day-update-delete\/","url":"https:\/\/sqlity.net\/en\/1595\/a-join-a-day-update-delete\/","name":"A Join A Day \u2013 UPDATE & DELETE - sqlity.net","isPartOf":{"@id":"https:\/\/sqlity.net\/en\/#website"},"primaryImageOfPage":{"@id":"https:\/\/sqlity.net\/en\/1595\/a-join-a-day-update-delete\/#primaryimage"},"image":{"@id":"https:\/\/sqlity.net\/en\/1595\/a-join-a-day-update-delete\/#primaryimage"},"thumbnailUrl":"http:\/\/sqlity.net\/wp-content\/uploads\/2012\/12\/simple-select-query.jpg","datePublished":"2012-12-29T15:00:06+00:00","dateModified":"2014-11-13T18:49:43+00:00","author":{"@id":"https:\/\/sqlity.net\/en\/#\/schema\/person\/bcffd8c572bc2f1bd10fdba80135e53c"},"description":"Do you need to pull in data from several tables to update just one? This post shows how a join can be incorporated in an update or delete statement.","breadcrumb":{"@id":"https:\/\/sqlity.net\/en\/1595\/a-join-a-day-update-delete\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/sqlity.net\/en\/1595\/a-join-a-day-update-delete\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/sqlity.net\/en\/1595\/a-join-a-day-update-delete\/#primaryimage","url":"http:\/\/sqlity.net\/wp-content\/uploads\/2012\/12\/simple-select-query.jpg","contentUrl":"http:\/\/sqlity.net\/wp-content\/uploads\/2012\/12\/simple-select-query.jpg"},{"@type":"BreadcrumbList","@id":"https:\/\/sqlity.net\/en\/1595\/a-join-a-day-update-delete\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/sqlity.net\/en\/"},{"@type":"ListItem","position":2,"name":"A Join A Day \u2013 UPDATE &#038; DELETE"}]},{"@type":"WebSite","@id":"https:\/\/sqlity.net\/en\/#website","url":"https:\/\/sqlity.net\/en\/","name":"sqlity.net","description":"Quality for SQL","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/sqlity.net\/en\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/sqlity.net\/en\/#\/schema\/person\/bcffd8c572bc2f1bd10fdba80135e53c","name":"Sebastian Meine","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/4ab0a6d02dd494849a584a2c3c8bc3bdcef1d0aa5f87e98bf905dbdb9ad2ce3a?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/4ab0a6d02dd494849a584a2c3c8bc3bdcef1d0aa5f87e98bf905dbdb9ad2ce3a?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/4ab0a6d02dd494849a584a2c3c8bc3bdcef1d0aa5f87e98bf905dbdb9ad2ce3a?s=96&d=mm&r=g","caption":"Sebastian Meine"},"sameAs":["http:\/\/sqlity.net","https:\/\/x.com\/sqlity"]}]}},"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p2wXuw-pJ","jetpack-related-posts":[],"_links":{"self":[{"href":"https:\/\/sqlity.net\/en\/wp-json\/wp\/v2\/posts\/1595","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/sqlity.net\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/sqlity.net\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/sqlity.net\/en\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/sqlity.net\/en\/wp-json\/wp\/v2\/comments?post=1595"}],"version-history":[{"count":0,"href":"https:\/\/sqlity.net\/en\/wp-json\/wp\/v2\/posts\/1595\/revisions"}],"wp:attachment":[{"href":"https:\/\/sqlity.net\/en\/wp-json\/wp\/v2\/media?parent=1595"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/sqlity.net\/en\/wp-json\/wp\/v2\/categories?post=1595"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/sqlity.net\/en\/wp-json\/wp\/v2\/tags?post=1595"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}