SQL Update with Values from Second Table
UPDATE table SET col1 = a.col1, col2=a.col2 FROM anotherTable a WHERE a.anotherTableID = 1
2757 users tagging and storing useful source code snippets
Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world (or not, you can keep them private!)
UPDATE table SET col1 = a.col1, col2=a.col2 FROM anotherTable a WHERE a.anotherTableID = 1
IF NOT EXISTS ( SELECT * FROM [information_schema].[columns] WHERE table_name = 'Customer' AND table_schema = 'dbo' AND column_name = 'FavoriteColorId' ) BEGIN ALTER TABLE [dbo].[Customer] ADD FavoriteColorId int
cp -a pmwiki-new/. pmwiki
cp -Rpv pmwiki-new/. pmwiki
UPDATE [Crm].[tbPartyLegalEntityData] SET [CompanyType] = ape.[CompanyType], [EmployeesCount] = ape.[EmployeesCount] FROM [Crm].[tbPartyLegalEntityData] p INNER JOIN App.[tbApplicationPersonEmployer] AS ape ON ape.[Bulstat] = p.[Bulstat] WHERE ape.[Bulstat] <> '!' AND [ape].[EmployeesCount] IS NOT NULL AND [ape].[CompanyType] IS NOT NULL
// count users with filter select Count(surname+firstname) as duplicates, surname, firstname from c_contact where show_record=1 group by surname, firstname having Count(surname+firstname) > 1 order by duplicates, surname, firstname // original code SELECT column,COUNT(*) c FROM table GROUP BY column HAVING COUNT(*) > 1 //update code update c_contact set duplicates = dbo.func_get_duplicates(surname, firstname)