I have two tables.
tblCategories - which holds a list of categories. Fields are CategoryID, CategoryDescription
tblJobCategories which holds a list of categories selected for a specific job. Fields are JobCategoryID(Primary key), CategoryID and JobID
When a user is looking at a new job they can select a categories link which displays a list of categories from tblCategories. They can select one or more of the categories and these are written to tblJobCategories.
When they are editing the job, I want them to click on the Categories link to again display the list of Categories from tblCategories but, I'd like to show the checkboxes next to Categories already selected as being ticked.
So, I have
to get the generic list of categories andCode:Select CategoryID, CategoryDescription from tblCategories
to get the list of Categories for that job.Code:Select CategoryID from tblJobCategories WHERE JobID = @JobID
How can I 'combine' the two statements so I can flag which categories in the generic list already appear in the specific list?
Thanks for any help.




Reply With Quote