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
 Transact-SQL (2000)
 Data extract query

Author  Topic 

imughal
Posting Yak Master

192 Posts

Posted - 2004-08-19 : 01:04:40
hi,

i have to tables unprocessedfiles and processed files. The table structure of both table are same as follow.

fileid, clientid, month, year, filename, upload_date

Clinet upload file in unprocessedfiles table. Then we processed that files and again upload in processedfile table.

Client may send particluar client data no of time in single month. That create multiple record of same client in that one. for exam
1 121 mar 2004 file1 02-08-2004
3 121 apr 2004 file2 06-08-2004
2 121 may 2004 file3 22-08-2004

we recieve 3 files in aug month. We just processed 2 files and these processed data saved in processedfiels table as follow

1 121 mar 2004 file1 05-08-2004
3 121 apr 2004 file2 09-08-2004

Now i have to show in query which files are still in pending or to be processed just we have last record.

2 121 may 2004 file3 22-08-2004 [unprocssed]

so how i can displayed that type of record is there any way. thx in advance.



ditch
Master Smack Fu Yak Hacker

1466 Posts

Posted - 2004-08-19 : 01:10:26
[CODE]
SELECT a.fileid, a.clientid, a.filename, a.upload_date
from unprocessedfiles a
where not exists(select b.fileid, b.clientid, b.filename, b.upload_date
from processedfiles b
where a.fileid = b.fileid
and a.clientid = b.clientid
and a.filename = b.filename
and a.upload_date = b.uploaddate)
[/CODE]

Duane.
Go to Top of Page
   

- Advertisement -