Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6621273
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T21:14:30+00:00 2026-05-25T21:14:30+00:00

I have a modal pop up that currently holds checkboxes in it for an

  • 0

I have a modal pop up that currently holds checkboxes in it for an admin to be able to add features to a product. I needed to change this to be able to get tied to the category of the product on the current page, but my sql statement isn’t working.

The tables here are Feature, Category and Marketing. Feature connects to Category with the CategoryID(named CategoryID in Feature & in Category tables), and Feature connects to Marketing with the FeatureID(called MarketingData in the Marketing table)

The MarketingTypeID of 3 tells the Marketing table to look for a Feature and will jump over to the feature table. The select statement worked before I added the Category table stuff to it, so obviously I coded that part wrong. Can someone help me get the select statement working?

This works:

SELECT DISTINCT FeatureID, FeatureTitle 
FROM Feature 
WHERE FeatureID NOT IN 
(SELECT m.MarketingData FROM Marketing 
WHERE MarketingTypeID = 3 AND ProductID = @ProductID) 
ORDER BY FeatureTitle

This doesn’t:

SELECT DISTINCT f.FeatureID, f.FeatureTitle FROM Feature f 
INNER JOIN Category c 
ON c.CategoryID = f.CategoryID 
WHERE f.CategoryID = @CategoryID 
AND f.FeatureID NOT IN 
(SELECT m.MarketingData FROM Marketing m 
WHERE m.MarketingTypeID = 3 AND m.ProductID = @ProductID) 
ORDER BY f.FeatureTitle

enter image description here

EX: FeatureID #23, Web Tutorials, has a CategoryID of 32….this Category is called Platforms and is located in the Category table. FeatureID #23 is NOT in the Marketing table, therefore is NOT associated to the Product that was chosen, which is ProductID #1. I need a checkbox that says Web Tutorials to show up in the modal. Like I said before, it was just fine before I added all the stuff about the Category that is associated to the product that was selected by the user.

UPDATE: I have no idea why I was trying to write that statement the way I had it. I realized that it was much easier than I had originally thought and changed the statement. This works now, thank you for all the help everyone! I changed the SELECT statement to:

"SELECT DISTINCT f.FeatureID, f.FeatureTitle 
FROM Feature f 
LEFT JOIN Category c ON c.CategoryID = f.CategoryID 
WHERE f.CategoryID IN 
(SELECT CategoryID FROM CategoryLink 
WHERE ProductID = @ProductID) 
AND f.FeatureID NOT IN 
(SELECT m.MarketingData FROM Marketing m WHERE m.MarketingTypeID = 3 
AND m.ProductID = @ProductID) 
ORDER BY f.FeatureTitle"
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T21:14:30+00:00Added an answer on May 25, 2026 at 9:14 pm

    If you compare this JOIN:

     FROM Feature f INNER JOIN Category c ON c.CategoryID = f.CategoryID 
    

    with the database structure you’ll see that you’re trying to use a column (Feature.CategoryID) that does not exist in your database. In fact, with the existing design you’re going to have to write a pretty involved query to get from Feature to Category.

    It may be true, however that there is a more direct relationship between Categories and the Features they can have that is not yet represented in your database. If that’s true, you’ll need to add a table CategoryFeatureLink, then use that table along with Category and Feature in a three-way JOIN.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a modal pop up that comes up when a hyperlink is clicked..
I have an ASP.NET application that also uses jQuery for modal pop-ups. If I
I have a modal pop extender that has a user control in it, I
I have a modal/pop-up form frmEditContact open on this form there is a combo
I have a modal that I pop up with jQuery with a textfield on
I have a pop-up, (what should be modal), dialogue for messages to the user
I have a Delphi 2006 app which can pop up a modal dialog in
I have a modal window that uploads files to server. Works great. Upon completion
I have a modal pop up function on my website, but i don't want
I have a jquery dialog modal box pop up for logging into my website.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.