Results 1 to 3 of 3
  1. #1
    Join Date
    Jan 2004
    Posts
    9

    Red face Unanswered: Plz solve this Query

    chiranjeevi
    raveendra
    sreenivasarao
    koteswar
    manoj
    sangeetharanika


    Here my query is
    in the above names i want to find out the persons whoz names consist of exact 2 a's
    eg output:
    raveendra

    assume that the names are ename and table name is emp.

    Thanks in advance
    Plz mail this qury to chiru_y2k@yahoo.com

    Chiranjeevi

  2. #2
    Join Date
    Jan 2003
    Location
    India
    Posts
    523

    Re: Plz solve this Query

    Originally posted by chiru_y2k
    chiranjeevi
    raveendra
    sreenivasarao
    koteswar
    manoj
    sangeetharanika


    Here my query is
    in the above names i want to find out the persons whoz names consist of exact 2 a's
    eg output:
    raveendra

    assume that the names are ename and table name is emp.

    Thanks in advance
    Plz mail this qury to chiru_y2k@yahoo.com


    Chiranjeevi





    select * from emp where patindex('%a%',ename) =2

  3. #3
    Join Date
    Jan 2003
    Location
    Massachusetts
    Posts
    5,799
    Provided Answers: 11
    Borowing a page from Brett here...

    select ename
    from emp
    where len(replace(ename, 'a', '') + 2 = len(ename)

Posting Permissions

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