創建更新查詢我有兩個表:請告訴我如何爲這樣一個問題
1.
CREATE TABLE [dbo].[HotelSourceMap](
[hotelsourcemapid] [bigint] IDENTITY(1,1) NOT NULL,
[dspartnerid] [bigint] NOT NULL,
[dshotelid] [bigint] NOT NULL,
[countrycode] [varchar](5) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[countryid] [bigint] NULL)
2.
CREATE TABLE [dbo].[country](
[countryId] [smallint] IDENTITY(1,1) NOT NULL,
[countryName] [varchar](50) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
[countryCode] [varchar](2) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL)
的情況是這樣的: 我想從country.countryid更新HotelSourceMap表countryid。 其中hotelsourcemap.countrycode = country.countrycode
一些事情是這樣的:
UPDATE HotelSourceMap
SET
HotelSourceMap.countryid =country.countryId
WHERE
HotelSourceMap.countrycode = country.countryCode
哇..非常好的查詢.. – 2010-01-08 07:52:45