Breaking News
Loading...
29/05/2014

Sử dụng Top with Ties trong SQL Server

CREATE TABLE A (X INT);
INSERT INTO A VALUES (1),(2),(3),(4);
CREATE TABLE B (Y INT);
INSERT INTO B VALUES (1),(2),(3),(4),(5),(5),(5),(5);

 

SELECT TOP ( ( SELECT COUNT(*)

                FROM A

             ) + 1 ) WITH TIES *

    FROM B

    ORDER BY Y; 

0 comments:

Post a Comment

 
Toggle Footer