how to add column in table and Numbering from 1 to the end

E_Gold

Registered User.
Local time
Today, 12:54
Joined
Sep 18, 2010
Messages
26
hi

i have this table:

MEN
Fname | Lname
AA | AA1
BB | BB1
CC | CC1


i need to add column ID and Numbering from 1 to the end

MEN
Fname | Lname | ID
AA | AA1 | 1
BB | BB1 | 2
CC | CC1 | 3

**i need it in SQL Syntax not with design work**

i work on access 2007

thanks
 
Your SQL will look something like;
Code:
SELECT EmpSales.WEndDate, EmpSales.Sales, TBL_Employee.EmpGname, TBL_Employee.EmpFName, TBL_Title.Title, (Select count(*) from Query1  Where [Sales] > [EmpSales].[Sales])+1 AS Rank
FROM (TBL_Employee INNER JOIN TBL_Title ON TBL_Employee.TitleID = TBL_Title.TilteID) INNER JOIN TBL_EmpSales AS EmpSales ON TBL_Employee.EmployeeID = EmpSales.EmplID
GROUP BY EmpSales.WEndDate, EmpSales.Sales, TBL_Employee.EmpGname, TBL_Employee.EmpFName, TBL_Title.Title
HAVING (((EmpSales.WEndDate)=[forms]![Form1]![combo8]))
ORDER BY EmpSales.Sales DESC;
The attached DB will give you some context and the query this is based on is QRY_EmplSort.
 

Attachments

Users who are viewing this thread

Back
Top Bottom