Results 1 to 5 of 5
  1. #1
    Join Date
    Dec 2013
    Posts
    2

    Unanswered: Sql query based on OR condition!!

    Hi team-
    I have a table emp which is having four columns -emp name,empid,deptid and location.

    i need to frame a query in such a way that we need to pass a runtime value for a temp variable ,first it should search the value in the column- empid if the particular value is not found in the column empid ..it should directly go and search in deptid...

  2. #2
    Join Date
    Jun 2003
    Location
    West Palm Beach, FL
    Posts
    2,713

    Cool

    Quote Originally Posted by senmng View Post
    Hi team-
    I have a table emp which is having four columns -emp name,empid,deptid and location.

    i need to frame a query in such a way that we need to pass a runtime value for a temp variable ,first it should search the value in the column- empid if the particular value is not found in the column empid ..it should directly go and search in deptid...
    Mmmm, interesting homework.
    What have you coded?
    The person who says it can't be done should not interrupt the person doing it. -- Chinese proverb

  3. #3
    Join Date
    Dec 2013
    Posts
    2
    i tried with case statement ..but it didn't work at all.

  4. #4
    Join Date
    Jun 2003
    Location
    West Palm Beach, FL
    Posts
    2,713

    Thumbs down

    Well, We cannot make any determination on an invisible or maybe secret sql query, perhaps you would like to show us what you did?
    The person who says it can't be done should not interrupt the person doing it. -- Chinese proverb

  5. #5
    Join Date
    Jun 2004
    Location
    Liverpool, NY USA
    Posts
    2,509
    We help with homework but we don't write out homework. Sorry!
    Bill
    You do not need a parachute to skydive. You only need a parachute to skydive twice.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •