Table Value Constructors solution for question 8528061

0

Please login or register to vote for this query.

(click on this box to dismiss)

- http://stackoverflow.com/questions/8528061/

Stack Overflow

Q&A for programmers

CREATE TABLE #tblEntity
( ID INT
, Name CHAR(10)
) ;

INSERT INTO #tblEntity
(ID , Name)
VALUES
( 1 , 'One') ,
( 2 , 'Two') ;

SELECT t.ID, t.Name, o.Ordr AS "Order"
FROM #tblEntity AS t
  JOIN
    ( VALUES
         (1,2)
       , (2,1)
    ) AS o(ID, Ordr)
    ON o.ID = t.ID ;

Enter Parameters

Options:
Switch sites:
loading Hold tight while we fetch your results
:records returned in :time ms:cached