我正试图从一个二级表中的数据中更新一个总表中的具体数据。
我有一个10万列的主食,其中一栏为“UniqueCode”,一部独特的阿尔法法典,另一栏为“Data”,其中载有一系列案文。 我有大约2 000个牢房的二级,有2个栏,即“新元”和“住房”。 “新数据”是另一条插图,“文化”是“阿尔法法典”,相当于总表格中的“大学”。
我想更新主文中的“数据”一栏,因为从中学到的《阿尔法法典》与《阿尔法法典》平等,因此与第二桌的“新数据”相同。
如果在努力寻找办法,将不胜感激。
我正试图从一个二级表中的数据中更新一个总表中的具体数据。
我有一个10万列的主食,其中一栏为“UniqueCode”,一部独特的阿尔法法典,另一栏为“Data”,其中载有一系列案文。 我有大约2 000个牢房的二级,有2个栏,即“新元”和“住房”。 “新数据”是另一条插图,“文化”是“阿尔法法典”,相当于总表格中的“大学”。
我想更新主文中的“数据”一栏,因为从中学到的《阿尔法法典》与《阿尔法法典》平等,因此与第二桌的“新数据”相同。
如果在努力寻找办法,将不胜感激。
UPDATE MasterTable
SET
Data = s.New_Data
FROM MasterTable m
INNER JOIN SecondaryTable s ON m.UniqueCode = s.Code
update master
set data = s.new_data
from master m
inner join second s on m.alphacode = s.code
或
update master
set data = s.new_data
from master m, second s
where m.alphacode = s.code
I ve got two tables: TableA Col1 Col2 TableB Col3 Col4 I want to join them together: SELECT * from TableA join TableB ON (...) Now, in place of ... I need to write an expression ...
TSQL query to select all records from Customer that has an Order and also select all records from customer that does not have an Order. The table Customer contains a primary key of CustomerID. The ...
I have a stored procedure which takes an XML parameter and inserts the data into multiple tables. If I run the stored procedure into a database using a SSMS query window, everything works fine. ...
Have a win 2003 box with MSSQL 2005 running on it. There is a database which is populated every morning with new/modified SalesOrder made the previous day. The database has several tables: SalesOrder, ...
I have a table with the following fields Id Name IsPublic i need to write a sql query that updates IsPublic to false where name has a duplicate. Only one of the duplicates should have IsPublic = ...
I have a Transact-SQL query that uses the IN operator. Something like this: select * from myTable where myColumn in (1,2,3,4) Is there a way to define a variable to hold the entire list "(1,2,3,4)"? ...
I ve got a content management system that contains a hierarchical structure of categories, with sub-categories subject to different ordering options at each level. Currently, that s retrieved by a (...
I m trying to transform the SQL Query below into Linq to SQL select Categorias.IdCategoria, Categorias.Nome, SUM(lancamentos.valor) from lancamentos left outer join Categorias on Lancamentos....