Juzer John Spencer <
[email protected]> napisa³
| Hopefully, you know how to use the SQL window to build queries. If
| not, you cannot build the first query in design view. Post back and
| ask for step by step instructions on setting up the first query or
| using DCount to get the rank in design view. DCOUNT will be slow if
| you have any significant number of records to process.
There is no need of using DCount() function, while we have subquerys.
| First Saved Query:
| SELECT A.JobNo, A.Employee
| , 1 + Count(B.Employee) As Rank
| FROM [YourTable] As A LEFT JOIN [YourTable] as B
| ON A.JobNo = B.JobNo
| AND A.Employee>B.Employee
| GROUP BY A.JobNo, A.Employee
Or:
Select
JobNo,
Employee,
(Select count(*) from YourTable t2
where t2.JobNo = t1.JobNo
and t2.id <= t1.id) as Rank
From
YourTable t1
(I hope "YourTable" has primary key ID
)
I have not tested this and I don't know which query will be faster for
relatively large tables (mine with subquery or yours with join and group
by)
And which pivot-query based on those two querys will be faster?