Hi
I've got 2 tables Categories and tblID
Categories contains 4 columns (ID, BroadItem, Item, RelatedItem)
Sample Data
-----------
142, Forestry, tree maintenance, N/A
143, Forestry, logging, N/A
144, Forestry, consulting, N/A
145, Forestry, Timber Mgt, N/A
the user can select one or more of these categories which values get stored in tblID (ID, BroadID, uniqueid, Detailsd)
Sample Data
-----------
tree maintenance, forestry, 81, 2504
logging, forestry, 81, 2504
tree maintenance, forestry, AC, 2505
logging, forestry, AC, 2505
Timber Mgt, forestry, AC, 2505
the user can be uniquely identified by columns uniqueid or detailsid.
if user 2505 comes back and want to add a new category it should only give them consulting as a choice (because they hacve already selected the other 3)
User 2504 should get 2 choices, consulting and Timber Mgt.
I tried creating the following view and using in my asp as
which i thought was working ! but using that user 2504, for example, they would only receive one choice, namely consulting, because user 2505 has already selected three (if that makes sense) I want user 2505 to get 1 choice and user 2504 to get 2 choices !
hope that makes sense !?!
thanks
I've got 2 tables Categories and tblID
Categories contains 4 columns (ID, BroadItem, Item, RelatedItem)
Sample Data
-----------
142, Forestry, tree maintenance, N/A
143, Forestry, logging, N/A
144, Forestry, consulting, N/A
145, Forestry, Timber Mgt, N/A
the user can select one or more of these categories which values get stored in tblID (ID, BroadID, uniqueid, Detailsd)
Sample Data
-----------
tree maintenance, forestry, 81, 2504
logging, forestry, 81, 2504
tree maintenance, forestry, AC, 2505
logging, forestry, AC, 2505
Timber Mgt, forestry, AC, 2505
the user can be uniquely identified by columns uniqueid or detailsid.
if user 2505 comes back and want to add a new category it should only give them consulting as a choice (because they hacve already selected the other 3)
User 2504 should get 2 choices, consulting and Timber Mgt.
I tried creating the following view and using in my asp as
Code:
sqlstmt="Select * FROM vwCatDetails where Expr1 = '" & request("UserID") & "'"
which i thought was working ! but using that user 2504, for example, they would only receive one choice, namely consulting, because user 2505 has already selected three (if that makes sense) I want user 2505 to get 1 choice and user 2504 to get 2 choices !
hope that makes sense !?!
thanks
Code:
CREATE VIEW dbo.vwCatDetails
AS
SELECT DISTINCT TOP 100 PERCENT a.*, b.DetailsID AS Expr1
FROM dbo.Categories a INNER JOIN
dbo.tblID b ON a.BroadItem = b.BroadID
WHERE (a.Item NOT IN
(SELECT id
FROM tblID
WHERE broadid = a.broaditem))
ORDER BY 3 asc