» How can I do an UPDATE statement with JOIN in SQL?
How can I do an UPDATE statement with JOIN in SQL?
|August 18, 2009
Posted by forumadmin
I need to update this table in MS SQL Server 2005 with data from its ‘parent’ table, see below:
sale.assid contains the correct value to update
ud.assid. What query will do this? I’m thinking a join but I’m not sure if it’s possible.
More Related Questions
- SQL update query using joins I have to update a field with a value which is returned by a join of 3 tables.
,im.sku as iSku
,gm.SKU as GSKU
,mm.ManufacturerId as ManuId
- How do I create unique constraint that also allows nulls in sql server Adding a column to table, and I want a unique constraint, so the column will insert GUID's, but to allow for existing data before column was added, I need to allow for NULL's in the […]
- How to SELECT * INTO [temp table] FROM [stored procedure] How do I do a SELECT * INTO [temp table] FROM [stored procedure]? Not FROM [Table] and without defining [temp table]?
Select all data from BusinessLine into tmpBusLine works fine.
- SQL Server – pull X random records per state I have a table with records for each zip code in the united states. For the purposes of displaying on a map, I need to select X random records per state. How would I go about doing […]
- How to append to a text field in t-sql SQL Server 2005 What is the best way to append to a text field using t-sql in Sql Server 2005?
With a varchar I would do this.
update tablename set fieldname = fieldname + 'appended string'
But this […]
- How important is the order of columns in indexes? I've heard that you should put columns that will be the most selective at the beginning of the index declaration. Example:
CREATE NONCLUSTERED INDEX MyINDX on Table1
- TSQL Finding Order that occurred in 3 consecutive months Please help me to generate the following query. Say I have customer table and order table.
- How do I insert multiple rows WITHOUT repeating the "INSERT INTO dbo.Blah" part of the statement? I know I've done this before years ago, but I can't remember the syntax, and I can't find it anywhere due to pulling up tons of help docs and articles about "bulk imports".
Here's what I […]
- sql query for displaying start/end points with time interval I have a table called vehicle_Summary and the data loks like:
A_Date vehicle_Name Location_Name
2012-02-08 09:36:20.000 AA000AA […]
- sp_replmonitorsubscriptionpendingcmds into a table [How2] Im looking to making a job that will tell me the number of pending cmd's on the replication,
Im using sp_replmonitorsubscriptionpendingcmds and im trying my best to put it into a […]