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
 SQL Server Development (2000)
 Joins for 3 tables

Author  Topic 

meetas
Starting Member

6 Posts

Posted - 2003-03-11 : 13:14:45
I always get stuck. I try code I used & working, but it will not work. Ok so here is my question.
Database - Access
I've 3 tables
CAtegory - where categorynames are stored.
fields: categoryid - datatype - text
Description - Name of category - datatype - text

Second table
Promocategory - which shows only those category wchich has promotion going on.
Fields: pcatid - comes from categoryid table
psubcatapp - If subcategory applies datatype y/n

Third table
promoscat_catapp
for some of these categories, subcategories are applied. So this table stores that information.
fields
prsscatapp - subcategoryid comes form promotional subcategory
prscatapp - categroy id to which subcategory is applied.

Now I want to display all promotional category. That can be done by sql statement below
sql = "select categories.*, promocategory.* from categories, promocategory where categories.categoryid = promocategory.pcatid "

now how can I show categories which are selected as checked and categories not selected not checked. Category name will be displayed as checkbox.
I'm not quite sure as how to connect third table promoscat_catapp, so that it checks if catgoryid is in that table and subcategoryid(i've do have that value passed from earlier page) = to subcategory id in the table.

Any help will be greatly appreciated.
Thanks in advance

   

- Advertisement -