Can someone help with this SQL

Jim W

Registered User.
Local time
Today, 18:59
Joined
Feb 4, 2003
Messages
198
I'm trying to creat a a sequencial number field in a query. Field Call ID is a autonumber so no duplicates and Timeone is a Date / Time format. When the query runs it works fine as long a the Timeone field is different but if there are any ones same then I get duplicates in my sequencial number.
any help or ideas?
Jim

SELECT (Select Count(1) FROM [Tble-Downs Report] A
WHERE A.[Call ID] <=[Tble-Downs Report].Call ID]) AS Sequence, [Tble-Downs Report].[Call ID],[Tble-Downs Report].[Timeone],[Tble-Downs Report].[Customer Number]
FROM [Tble-Downs Report]
ORDER BY [Tble-Downs Report].[Timeone];
 
Since users shouldn't be viewing queries anyway, why not just generate the number in the report where it is simple and efficient? Keep in mind that the sequence of two rows where the sort fields are identical is unpredictable.
 
I looked into the report solution but here is the problem. I'm trying to creat a priority value based on how long an event has been going on. The longer the higher priority. Now if I use a query then the priority gets set when the query runs. On the report it goes in order. But there are different products that I'm sorting for so I thought I would use a query to set the value sorted by Timeone then when the report opens the report will sort by product but the pirority will be already set. Does this make any sence. This would be how the report would show the data.

Priority Product Timeone
1 0001 4/1/04 11:00
4 0001 5/4/04 06:00
2 0002 4.10/04 07:00
3 0002 5/1/04 19:00
5 0003 5/5/04 15:00

Jim

If there is an easier way please let me know.
Jim
 

Users who are viewing this thread

Back
Top Bottom