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 987721
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T05:31:35+00:00 2026-05-16T05:31:35+00:00

I am using .NET 4.0 & C# and SQL Server 2008. I have a

  • 0

I am using .NET 4.0 & C# and SQL Server 2008. I have a table Products with a column called Keywords. I have another table Interests with 2 columns Accept and Reject. All 3 columns contains keywords separated by commas. I need to match:

  1. If Accept & Reject are empty, then there is a match
  2. If Accept has keywords, then there should be at least 1 keyword match between Accept & Keywords
  3. If Reject has keywords, then there should be no matches between Reject & Keywords
  4. Combination of 2 & 3

Ideally I’d like to do this in a SQL query. I’m open to stored procedures either Managed or T-SQL in that order.


OK, based on the comments, I’ve added these tables:

Keywords_Products [id (FK to Products), Keyword]
Keywords_Accepted [id (FK to User), Keyword]
Keywords_Rejected [id (FK to User), Keyword]

So, I need a set of products for a given userId, based on the 4 rules above.

  • 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-16T05:31:36+00:00Added an answer on May 16, 2026 at 5:31 am

    If you are stuck with the table structure as-is (and I suspect that you are), then you’re probably best off breaking this up into multiple pieces. Your first piece is to create a function that can split strings based on a delimiter. How to do so has been answered well in another question.

    It’d also help if you create a refinement on the split function by creating one specific to the Keywords field on the Products table. Something where you can pass in the ProductId and have it return the keywords for that ProductId.

    From there, you can select interests matching a given product with something like

    SELECT * FROM Interests i
    WHERE 
        (i.Accept = '' AND i.Reject = '')
        OR
        (
            EXISTS (SELECT * FROM Split(',', i.Accept) ia WHERE ia.[Value] IN (ProductKeywords(@ProductId)))
            AND
            NOT EXISTS (SELECT * FROM Split(',', i.Reject) ir WHERE ir.[Value] IN (ProductKeywords(@ProductId)))
        )
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 498k
  • Answers 499k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer The problem was that I was triggering the popup call… May 16, 2026 at 12:26 pm
  • Editorial Team
    Editorial Team added an answer Take a look at the dateFromString: method on NSDateFormatter May 16, 2026 at 12:26 pm
  • Editorial Team
    Editorial Team added an answer I'm a bit baffled about what you're doing. Going off… May 16, 2026 at 12:26 pm

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Related Questions

I use VS 2008, .net 3.5 for generate page html using XSLT. I have
The goal: To create a .NET dll i can reference from inside SQL Server
I tried using the Moving Boxes jQuery Plugin in Asp.net Mvc. It works in
I'm writing a log parser for an asp.net mvc2 web application. I use Entity
SQL reporting services has a little search box in the top of the report
I asked this question earlier, but I changed the table structure based on recommendations.
Integrating SimpleModal with ASP.NET I want to thank Eric for producing SimpleModal and compliment
I have the following scenario. I have a search page which is split into
(This post is soliciting personal experiences about storing XML; please share what you know.
It seems the world is awash with people having problems deploying RIA WCF services,

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.