I need to generate the following for my webpage,
This is a list of resrouces for CATEGORY_1
SUBCATEGORY_A
URL_A1
URL_A2
URL_A3
SUBCATEGORY_B
URL_B1
URL_B2
URL_B3
I have three tables, a URL table which has the url and subcategoryId, a
subcat table, which has the subcatId and subcatName, and a to-many
urlcat table, which has url and categoryId.
I tried
SELECT subcategoryId FROM libUrl
WHERE EXISTS (SELECT subcatName, subcatId FROM libSubcat
WHERE subcatId = subcategoryId)
GROUP BY subcategoryId
But it does not seem to be working. What's wrong?
TIA,
Annie
Given your brief description of your tables and the expected output
I'll take a guess at what you're looking for, but I might be way off.
SELECT s.subcatID, s.subcatName, u.url
FROM urlcat uc
INNER JOIN url u ON u.url = uc.url
INNER JOIN subcat s on s.subcatID = u.subcategoryID
WHERE uc.categoryID = @CategoryID
ORDER BY s.subcatName
It's just a guess, but maybe it's close to what you're looking for and
will point you in the right direction.
Good luck,
-Tom.
In article <39EC76EF...@mail.utexas.edu>,
Sent via Deja.com http://www.deja.com/
Before you buy.