t1: id name 1 a 2 b t2 anotherID id 1 2 2 1 我想在t2中添加 t1.name=a 的id,我用以下结构无法实现 INSERT T1 (anotherID _ID,id) 1, SELECT id FROM [T2] WHERE [T2].id= 'a' 多谢多谢,还有请问那种declare@ something varchar 的语言那里有详解 我适用vc的,这个不熟悉
USE pubs
SET NOCOUNT ON
GO
DECLARE @pub_id char(4), @hire_date datetime
SET @pub_id = '0877'
SET @hire_date = '1/01/93'
-- Here is the SELECT statement syntax to assign values to two local
-- variables.
-- SELECT @pub_id = '0877', @hire_date = '1/01/93'
SET NOCOUNT OFF
SELECT fname, lname
FROM employee
WHERE pub_id = @pub_id and hire_date >= @hire_date
下面是结果集:
fname lname
-------------------- ------------------------------
Anabela Domingues
Paul Henriot