Hi nedash,
Refer the sample query.
SQL
DECLARE @Order_users AS TABLE (Id INT IDENTITY,Name VARCHAR(50),Code INT,Type VARCHAR(50),Date DATE)
INSERT INTO @Order_users VALUES
('Waterfall',1111,'Film','2016-2-03')
,('Waterfall',1111,'Animation','2016-2-03')
,('Waterfall',1111,'Serial','2016-2-03')
,('Green',2222,'Film','2016-10-31')
,('Green',2222,'Serial','2016-10-31')
SELECT * FROM @Order_users
DECLARE @Code INT SET @Code = 1111
DECLARE @Order_Confirm AS TABLE (Id INT IDENTITY,Name VARCHAR(50),Code INT,Type VARCHAR(50),Date DATE)
INSERT INTO @Order_Confirm
SELECT Name,Code,Type,date
FROM @Order_users
WHERE Code = @Code
SELECT * FROM @Order_Confirm
Output
Id |
Name |
Code |
Type |
Date |
1 |
Waterfall |
1111 |
Film |
2/3/2016 |
2 |
Waterfall |
1111 |
Animation |
2/3/2016 |
3 |
Waterfall |
1111 |
Serial |
2/3/2016 |
4 |
Green |
2222 |
Film |
10/31/2016 |
5 |
Green |
2222 |
Serial |
10/31/2016 |
Inserted record to confirm table.
Id |
Name |
Code |
Type |
Date |
1 |
Waterfall |
1111 |
Film |
2/3/2016 |
2 |
Waterfall |
1111 |
Animation |
2/3/2016 |
3 |
Waterfall |
1111 |
Serial |
2/3/2016 |