•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the MS SQL section within the Web Development category of DaniWeb, a massive community of 392,022 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 4,268 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our MS SQL advertiser:
Views: 2464 | Replies: 2
![]() |
•
•
Join Date: May 2005
Posts: 1
Reputation:
Rep Power: 0
Solved Threads: 0
Hi!
i have a table with 3 fields: ParentFolder,DocumentNo and VersionNo
the DocumentNo give each document a unique number. ParentFolder is a number specifying which folder a document is in. and each document(with same name) can have many VersionNo(1,2,3 etc).
i am creating a house keeping function for user. this function accepts a number from user specifying how many version he would like to keep.
i have created a page that list out all folder in the db with a checkbox. user is able to checked the folder they want to housekeep.
the problem is how do i write a sql that will 'group' documents with same name, delete the document base on the input.
since the system only get the folder id and not each document id individually the system won't be able to pinpoint each document.
in dire need of help
Thanks in advance
i have a table with 3 fields: ParentFolder,DocumentNo and VersionNo
the DocumentNo give each document a unique number. ParentFolder is a number specifying which folder a document is in. and each document(with same name) can have many VersionNo(1,2,3 etc).
i am creating a house keeping function for user. this function accepts a number from user specifying how many version he would like to keep.
i have created a page that list out all folder in the db with a checkbox. user is able to checked the folder they want to housekeep.
the problem is how do i write a sql that will 'group' documents with same name, delete the document base on the input.
since the system only get the folder id and not each document id individually the system won't be able to pinpoint each document.
in dire need of help
Thanks in advance
•
•
Join Date: Jun 2005
Location: Nothamptonshire
Posts: 27
Reputation:
Rep Power: 4
Solved Threads: 1
Sounds like work for a stored procedure.
The problem being that the easiest way to do this is to have a sub-query select the documents grouped on the parentfolder and documentnumber, and use a 'TOP X' qualifier. Then have the main select query use the output of the subquery with the NOT IN comparison.
The problem being that the easiest way to do this is to have a sub-query select the documents grouped on the parentfolder and documentnumber, and use a 'TOP X' qualifier. Then have the main select query use the output of the subquery with the NOT IN comparison.
![]() |
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
•
•
•
•
•
•
•
•
DaniWeb MS SQL Marketplace
- sql statement (Visual Basic 4 / 5 / 6)
- decrementing values in data base (ASP)
- How to auto increment? (ASP.NET)
- Is it compulsory to have atleast one Unique per table in Sql Server2000? (MS SQL)
- Am I looking for PHP? (PHP)
- Giving records in MS Access unique numbers (MS Access and FileMaker Pro)
- MySQL newbie need help with create table definitons syntax (MySQL)
Other Threads in the MS SQL Forum
- Previous Thread: need urgent help for a query
- Next Thread: How does views work in MS SQL


Linear Mode