Query

  • Thread starter Thread starter Pass-the-Reality
  • Start date Start date
P

Pass-the-Reality

In my query, I wanted to create a row that autonumbers each line. Example of
current out put is

Adam 4-3-09
Bob 4-3-09
Carrie 4-3-09

I want my query to produce the below.

1 Adam 4-3-09
2 Bob 4-3-09
3 Carrie 4-3-09
 
Try this --
SELECT Q.[FullName], Q.[SomeDate], (SELECT COUNT(*) FROM [YourTable] Q1
WHERE Q1.[FullName]&Q1.[SomeDate] <= Q.[FullName]&Q.[SomeDate])+1 AS
Row, Q.[FullName], Q.[SomeDate]
FROM YourTable AS Q
ORDER BY Q.[FullName], Q.[SomeDate];
 
Back
Top