Francisco H Tapia
my.lists at verizon.net
Mon Feb 17 18:10:33 CST 2003
I need some brainstorming advice... maybe even a whole new way of thinking is in order ;o) I have the a table called tbl_ccStatus with the following fields... ccStatusID INT ccID INT StatusID INT UserID UNIQUEIDENTIFIER ccDateTime DATTIME When a new status is assigned to the Table it is in actuality Appended (inserted) into this table. Below is a table of what each ID acctually stands for. A normal process would have the record enter at ID 1, 3, 2, 5, 6, and finally 7. However being that nobody is perfect a record could be rejected when it arrives at the status ID 4 or 6. Thus the resulting record for a record could result in ID 1,3,2,5,4,(re-assigned 2), 5, 6, (re-assigned 2), 5, 6, 7. How often it is rejected depends on how well the record is processed. In the Desktop GUI, the users get two listboxes, one for new records, and one for currently processed records. But in the web implementation the web guys want to make it so that there are additional listboxes, such as, Rejected records, Rejected by Manager Records... New, Work In progress... They propose to modify the design so the first re-assigned ID would be an 8 instead of a 2, and the 2nd re-assigned be a 9 instead of a 2. What are your thoughts on this.. Below I've included a sample select statment, as you can see it has a subnested query, and another one in the where clause for an exists where I check records that have been emailed. Thanks, -Francisco http://rcm.netfirms.com ----- Original Message ----- : : 0 DELETED : 1 NEW : 2 Assigned : 3 Emailed : 4 Waiting Business Manager Approval : 5 Resolution : 6 Marked for Review : 7 Closed : : SELECT Status.CCID, StatusNames.StatusID as Status, Status.ccDateTime : FROM HaasCC.dbo.tbl_ccStatus AS Status : INNER JOIN (SELECT CCID, MAX(ccDateTIME) AS ccDateTime : FROM HaasCC.dbo.tbl_ccStatus : GROUP BY CCID) AS MaxStatus : ON Status.CCID = MaxStatus.CCID AND Status.ccDateTime = : MaxStatus.ccDateTime : INNER JOIN HaasCC.dbo.tbl_Status AS StatusNames : ON Status.StatusID = StatusNames.StatusID : WHERE EXISTS(Select CCid, StatusID : FROM HAAScc.dbo.tbl_ccStatus : Where StatusID = 3 AND Status.CCID = ccID) : AND StatusNames.StatusID <> 3 : : Order by Status.ccDateTIME DESC