SQL Insert from other table into new table
CREATE TABLE #Temporary
(
HoursThisYear int,
HoursLastYear int,
HoursBefore2010 int
)
INSERT
INTO #Temporary (HoursThisYear)
SELECT SUM(Hours) WHEN Year = '2011' FROM WorkFlow
I am very new at this, and not sure what I am 开发者_开发百科doing.
Assuming you're looking for help on the INSERT syntax.
INSERT INTO #Temporary
(HoursThisYear)
SELECT SUM(Hours)
FROM WorkFlow
WHERE Year = '2011'
CREATE TABLE #Temporary ( HoursThisYear int, HoursLastYear int, HoursBefore2010 int )
INSERT INTO #Temporary (HoursThisYear)
SELECT SUM(Hours)
FROM WorkFlow
WHERE Year = '2011'
this should work
CREATE TABLE #Temporary
(
HoursThisYear int,
HoursLastYear int,
HoursBefore2010 int
)
INSERT
INTO #Temporary (HoursThisYear)
SELECT SUM(Hours)
FROM WorkFlow
WHERE Year = '2011'
精彩评论