March 16, 2005 at 7:06 am
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???????
March 16, 2005 at 7:24 am
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.
March 16, 2005 at 8:11 am
I figured it out. and thank you for the comment on the uselessness of the count(*) !! absolutely right!
Thanks again
March 16, 2005 at 8:31 am
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