Autonumber Rows in a SELECT Statement - Microsoft SQL 2000
Posted on 2007-12-05
I have a view created to pull data from multiple tables. I need to add a field to the selected field that will autonumber rows returned. The number for each row must be unique. Below is my Statement.
Any help is appreciated.
SELECT TOP 100 PERCENT dbo.Profit.Company_ID, dbo.Profit.Company, dbo.Profit.Project_ID, dbo.Profit.Project, dbo.Profit.Revenue AS Commission, dbo.Profit.DateTime, dbo.Company.SLX_Company_ID
FROM dbo.Profit INNER JOIN
dbo.Company ON dbo.Profit.Company_ID = dbo.Company.Company_ID
WHERE (dbo.Profit.CommExpense = 1) AND (dbo.Profit.Revenue < 0) AND (NOT (dbo.Company.SLX_Company_ID IS NULL))
ORDER BY dbo.Profit.Project_ID