» SQL update query using joins
SQL update query using joins
|June 11, 2009
Posted by forumadmin
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
item_master im, group_master gm, Manufacturer_Master mm
im.mf_item_number like 'STA%'
and gm.ManufacturerID = mm.ManufacturerID
I want to update the
mf_item_number field values of table
item_master with some other value which is joined in the above condition.
How can I do this in MS SQL Server?
More Related Questions
- How can I do an UPDATE statement with JOIN in SQL? I need to update this table in MS SQL Server 2005 with data from its 'parent' table, see below:
- UPDATE from SELECT using SQL Server In SQL Server you can insert into a table using a select statement:
INSERT INTO table(col,col2,col3)
SELECT col,col2,col3 FROM other_table WHERE sql = 'cool'
How can I update via a […]
- 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 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 […]
- 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.
- 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 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.
- 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
- Using cross apply in update statement Is it possible to use the cross apply clause in the from part of an update statement, in SQL Server 2005? Asked By - guillegr123 Read […]
- How to update data as upper case first letter with t-sql command? I have a table on my database. My table's name is "Company". I want to change data "company_name" as upper case first letter. For example;