Welcome to SSC.
For any of the users here to answer your question(s) we'll need some things from you. In this case, we need DDL and Samples Data. There's a link in my signature on how you can do that.
On the matter of the error, the error message is giving you the answer. When using an aggregate, you will often need to include a GROUP BY clause. Have a Google, and see what you can learn there. If you have any question on it, then please do ask.
Once you've posted back with some DDL and sample data, someone will be able to help you further.
Excuse my typos and sometimes awful grammar. My fingers work faster than my brain does :-P
Please always remember to encapsulate your code in IFCode Markup. For example [code=sql] [/code]
to read Jeffs Guide on how to post SQL questions, and get swift and helpful answers from the community