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. Database & SysAdmin
  3. Database
  4. Help in designing search query

Help in designing search query

Scheduled Pinned Locked Moved Database
databasesalesregexxmlhelp
2 Posts 2 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.
  • N Offline
    N Offline
    NetBot
    wrote on last edited by
    #1

    Hi all, Table schema empid primary key emp_name emp_age emp_skills emp_Isactive I am storing multiple skills of a customer in same column separated with commas.I have designed a search form where in the employer enters skills in search box separated using commas. I want to match these skills irrespective of commas. for this purpose i used a stored proc and passed skills as parameters select skill from tbljob where skill like '%'+ISNULL(@skill1,skill)+'%' or skill like '%'+ISNULL(@skill2,skill)+'%' or skill like '%'+ISNULL(@skill3,skill)+'%' but if one of the skill 1,2,3 is null ie if user enters only 1 or 2 , it returns all rows because the other condition is always true . How can i use "OR" with other statements so that it works out

    M 1 Reply Last reply
    0
    • N NetBot

      Hi all, Table schema empid primary key emp_name emp_age emp_skills emp_Isactive I am storing multiple skills of a customer in same column separated with commas.I have designed a search form where in the employer enters skills in search box separated using commas. I want to match these skills irrespective of commas. for this purpose i used a stored proc and passed skills as parameters select skill from tbljob where skill like '%'+ISNULL(@skill1,skill)+'%' or skill like '%'+ISNULL(@skill2,skill)+'%' or skill like '%'+ISNULL(@skill3,skill)+'%' but if one of the skill 1,2,3 is null ie if user enters only 1 or 2 , it returns all rows because the other condition is always true . How can i use "OR" with other statements so that it works out

      M Offline
      M Offline
      Michael Potter
      wrote on last edited by
      #2

      change your ISNULL() NULL result to something that can't be located:

      ISNULL(@skill1,'&^%$')
      
      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