Teradata Auto-Increment Query

Can Teradata SQL Query do Auto-Increment?

I'm looking for something similar to

SELECT
  Date (Auto-Increment by 1 over Column 2),
  Column 2,
  Column 3
FROM Fake_Table
GROUP BY 1,2,3

And get something such as

Date        Column 2    Column 3
2012-06-11  A           A
2012-06-11  A           B
2012-06-11  A           C
2012-06-12  B           A
2012-06-13  C           B

Is this possible?

Answers


You should be able to use the ROW_NUMBER() window aggregate with a PARTITION BY and ORDER BY statement to provide you a seed value to add to the DATE.

Pseudo-Code:

SELECT
  CURRENT_DATE + ROW_NUMBER() OVER(PARTITION BY Column2,
                                   ORDER BY Column2)       AS MyDate
  Column2,
  Column3
FROM Fake_Table
GROUP BY 1,2,3

Need Your Help

teamcity ant build

ant build teamcity

So i have 4 project depend on each other with 4 different configuration in team city. when i run 1 they all run. but , each one of them is doing check out when starting his run , so it is possible ...

Why might changes be populated from one NSManagedObjectContext to another without an explicit merge?

objective-c cocoa-touch core-data nsmanagedobjectcontext

I'm working on an object import feature that utilizes multiple threads/NSManagedObjectContexts, using http://www.mac-developer-network.com/columns/coredata/may2009/ as my guide (note that I am deve...