none
count two words in column

    Question

  • i want to count two words like java and sql in one column and words either one word occurance in row it also count.

    Manish Khare

    Monday, April 29, 2013 3:41 PM

Answers

  • What is your current query? You may add to your query

    select ..., count(case when Resume like N'%sql%' then 1 else 0 end) over () as CountSQL, count(case when Resume like N'%java%' then 1 else 0 end) over() as CountJava from myTable where ...


    For every expert, there is an equal and opposite expert. - Becker's Law


    My blog

    Monday, April 29, 2013 5:01 PM
    Moderator

All replies

  • Can you post DDL of your table and some data samples?

    In the meantime, you may find this blog post helpful

    How to search for all words inclusive without using Full Text search


    For every expert, there is an equal and opposite expert. - Becker's Law


    My blog

    Monday, April 29, 2013 3:50 PM
    Moderator
  • Hi,

    Try like this..

    SELECT count(*) FROM Table1 WHERE SearchColumn LIKE '%java%' OR SearchColumn LIKE '%sql%'

    Regards,

    Brindha.

    Monday, April 29, 2013 4:16 PM
  • i have a  table consultant and a column resume i want to find how many time contain java,sql in this column.

    Manish Khare

    Monday, April 29, 2013 4:46 PM
  • What is the type of this column (resume) and would you like to use full text search capabilities for this column? 

    For every expert, there is an equal and opposite expert. - Becker's Law


    My blog

    Monday, April 29, 2013 4:48 PM
    Moderator
  • its nvarchar(max) type column and i use contains for search and i want to count how many time java , sql are in this column


    Manish Khare

    Monday, April 29, 2013 4:54 PM
  • What is your current query? You may add to your query

    select ..., count(case when Resume like N'%sql%' then 1 else 0 end) over () as CountSQL, count(case when Resume like N'%java%' then 1 else 0 end) over() as CountJava from myTable where ...


    For every expert, there is an equal and opposite expert. - Becker's Law


    My blog

    Monday, April 29, 2013 5:01 PM
    Moderator