Pregunta

I work with MS Access 07 and need a little help.

I have two tables TbProjectTeam and TbProjectList. I need to compare date of employee turn-out and date of project start. I used that SQL syntax:

SELECT [TbProjectTeam ].[Surname, name] 
FROM TbProjectTeam 
INNER JOIN TbProjectList
ON TbProjectTeam .[DateofTurnOut] <= TbProjectList.[DateOfStart] 
WHERE TbProjectList.[ID] = 1 
ORDER BY [Surname, name];

My aim is to replace 1 in TbSeznamUkolu.[ID] = 1 expression with something as ROW_NUMBER() OVER in SQL. MS Access doesn't support this function but unfortunately I need to know row index of all projects. I imagine that will be displayed matching employees for every row.

Can anyone help me please? Big thanks.

¿Fue útil?

Solución

MS Access has an AutoNumber data type that sets sequential numbers on records. Your data set would need to include an AutoNumber field to represent the ROW in T-SQL. Since the AutoNumber is numeric you could do > and < functions on it. The only problem with this is that the records will be numbered sequentially as they are added to the table. If you can control the sequence in which they are added then there is no problem, but if you were to add the AutoNumber field to an existing populated table, the sequence may not match your requirements.

I realise this question is a bit old but I hope this helps.

Otros consejos

DCOUNT function in spite of the efficiency issue provides a similar effect:

Just answered a similar answer here: How to show the record number in a MS Access report table?.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top