''where'' and ''Like'' HELP

  • SELECT column_name, count(*)

    FROM table_name

    WHERE column_name like ‘%AAAA BBB%’

    GROUP BY column_name

    I'm trying to run this simple select and it's failing on line 3.   Can anyone help me out with the syntax on this???????

  • Try running this statement in any database

    Select name, count(*) from dbo.SysObjects where name like 'sys%' group by name

    the only thing different is that I used ' instead of ’.

    If that still doesn't work, could you post the full statement along with the complete error message?

    Also you'll notice that the count(*) in this case is pretty useless since it's grouped by name and that each name is unique. If you only want the count then you'll have to remove the group by and the name from the select.

  • I figured it out.  and thank you for the comment on the uselessness of the count(*) !!  absolutely right!

    Thanks again

  • What was the problem?

    Please post so that others that find this thread can also fin a solution.

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply