Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Algorithms
  4. SQL select based on Boolean values

SQL select based on Boolean values

Scheduled Pinned Locked Moved Algorithms
database
3 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • O Offline
    O Offline
    ormonds
    wrote on last edited by
    #1

    I have a large number of articles. I have a large number of possible keywords. Each article has at least one keyword associated with it, but may have many keywords. There is a database containing a list of all articles and a boolean variable set to true for each keyword if that keyword applies. A user has a list of all keywords and selects those which interest them. I am trying to find a more elegant way to extract the list of relevant articles than a brute force SQL SELECT. Any suggestions would be appreciated!

    C E 2 Replies Last reply
    0
    • O ormonds

      I have a large number of articles. I have a large number of possible keywords. Each article has at least one keyword associated with it, but may have many keywords. There is a database containing a list of all articles and a boolean variable set to true for each keyword if that keyword applies. A user has a list of all keywords and selects those which interest them. I am trying to find a more elegant way to extract the list of relevant articles than a brute force SQL SELECT. Any suggestions would be appreciated!

      C Offline
      C Offline
      Caio Kinzel Filho
      wrote on last edited by
      #2

      I guess you will not be able to escape from a select statement...maybe you could try to use a stored procedure for that, or try to optimize the select, but not without a select I think

      Intelligence is almost useless for those who have nothing else! Email: caiokf@gmail.com

      1 Reply Last reply
      0
      • O ormonds

        I have a large number of articles. I have a large number of possible keywords. Each article has at least one keyword associated with it, but may have many keywords. There is a database containing a list of all articles and a boolean variable set to true for each keyword if that keyword applies. A user has a list of all keywords and selects those which interest them. I am trying to find a more elegant way to extract the list of relevant articles than a brute force SQL SELECT. Any suggestions would be appreciated!

        E Offline
        E Offline
        elektrowolf
        wrote on last edited by
        #3

        I think your database design is not ideal.. You should have a table for all the articles and a table for all possible keywords. In a third table you save all keyword-article associations (using the primary key of the article and keyword).

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups