how to use join with temp table
Microsoft Net Framework

how to use join with temp table

CREATE TABLE [dbo].[NormalTable](
    [Id] [int] NULL,
    [name] [nvarchar](50) NULL
) ON [PRIMARY]
GO
INSERT [dbo].[NormalTable] ([Id], [name]) VALUES (1, N'range1')
GO
INSERT [dbo].[NormalTable] ([Id], [name]) VALUES (2, N'Range2')
GO
INSERT [dbo].[NormalTable] ([Id], [name]) VALUES (3, N'Range3')
GO


CREATE TABLE #Temp
    ([id] int, [date] date, [score] int)
;

INSERT INTO #Temp
    ([id], [date], [score])
VALUES
    (1, '2013-04-13', 100),
    (2, '2013-04-14', 92),
    (3, '2013-04-15', 33)
;

SELECT N.* FROM NormalTable N
LEFT JOIN #Temp T ON N.id = T.ID


CREATE TABLE #Temp

([index] INT,minVal DECIMAL(18,2),maxVal DECIMAL(18,2))

 INSERT INTO #Temp
    ([index], [minVal], [maxVal])
 

Share This with your friend by choosing any social account


Upcoming Articles
You may also read following recent Post
Copyright Future Minutes © 2015- 2024 All Rights Reserved.   Terms of Service  |   Privacy Policy |  Contact US|  Pages|  Whats new?
Update on: Dec 20 2023 05:10 PM
03
07

New Messages

George Floyd
  • Edit Post Edit This Post within a Hour
  • Hide Chat Hide This Post
  • Delete Chat If inappropriate Post By Mistake
  • Report Inappropriate Chat
  • 4.5kb
  • Hi James! Please remember to buy the food for tomorrow! I’m gonna be handling the gifts and Jake’s gonna get the drinks
  • Hi James! Please remember to buy the food for tomorrow! I’m gonna be handling the gifts and Jake’s gonna get the drinks
  • Hi James! Please remember to buy the food for tomorrow! I’m gonna be handling the gifts and Jake’s gonna get the drinks