Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Detect 2nd and 3rd swipe of a cardmember

Author  Topic 

strongweb
Starting Member

12 Posts

Posted - 2001-07-01 : 21:30:46
Guys, i need to find the 2nd and 3rd time a card has been swiped. There are 1 million cardmembers with 40 million transactions between them..I can use this query to find the 2nd card swipe of a particular member

select TOP 1 t.card_no,t.date from
(
select TOP 2 card_no,date
from CAP
where card_no ='010007710053'
) As t
ORDER by date DESC

However, how do i run this for all 1 million members. Don't tell me i have to run 1 million select queries..

   

- Advertisement -