Quantcast
Channel: Teradata Forums - Database
Viewing all articles
Browse latest Browse all 14773

Get the next partition - response (4) by eejimkos

$
0
0
Hello,   Thank you for your replies....   Yes, we wanted to know for a given date , the next available partition . I was trying to find an alternatice solution(better for performance) ,   solution_1 : SELECT a.* FROM vt_tst a WHERE a.PARTITION = (SELECT MIN(b.PARTITION)                      FROM vt_tst b                      WHERE b.PARTITION > (SELECT c.PARTITION                                          FROM vt_tst c                                          WHERE c.col2 = '2012-02-28')) solution_2 : SEL * FROM (SEL T.*, PARTITION AS PART   FROM vt_tst T) TAB   INNER JOIN (SEL DIST.PART, MIN(DIST.PART) OVER (ORDER BY  (DIST.PART) ROWS BETWEEN 1 FOLLOWING AND 1 FOLLOWING) AS NEXT_P FROM (SEL DISTINCT PARTITION AS PART FROM vt_tst T ) DIST) D ON TAB.PART = D.PART   Thank you very much again. Any other ideas...  

Viewing all articles
Browse latest Browse all 14773

Trending Articles