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.
| Author |
Topic |
|
AskSQLTeam
Ask SQLTeam Question
0 Posts |
Posted - 2001-06-20 : 09:29:35
|
Nor Kamil writes "I was running this query :-
-- START Query------
IF EXISTS (SELECT * from sysobjects WHERE name='FIRSTSWIPEDETAILS') DROP TABLE FIRSTSWIPEDETAILS
SELECT a1.card_no, CONVERT(datetime,CONVERT(varchar, a1.date + a1.time,120)) AS timestamp, a1.points INTO FIRSTSWIPEDETAILS FROM CAP a1 WHERE (ISNULL(a1.date + a1.time, '9999-12-31 00:00:00') = (SELECT MIN(isnull(a2.[date] + a2.[time], '9999-12-31 00:00:00')) FROM CAP a2 WHERE a1.card_no = a2.card_no))
-- END query
I am processing card transactions of 1 million card holders. I have a transaction history for two years. My query objective is to detect the FIRST TIME a particular card has been used (hence the MIN(date) function used above. However, the query has been running for 24 hours..with no sign of stopping..Is my query optimized?..
the CAP table curently contains 40 million records. the MDF file is 7 GB...." |
|
|
|
|
|