# Syntax error in subqueries - Select clause

**URL:** <https://forum.codewithmosh.com/t/syntax-error-in-subqueries-select-clause/11284>\
**Category:** SQL\
**Created:** [March 15, 2022, 10:14am UTC](https://forum.codewithmosh.com/t/syntax-error-in-subqueries-select-clause/11284 "2022-03-15T10:14:27Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![srsr](https://avatars.discourse-cdn.com/v4/letter/s/aca169/32.png) [@srsr](https://forum.codewithmosh.com/u/srsr)\
**Post date:** [March 15, 2022, 10:14am UTC](https://forum.codewithmosh.com/t/syntax-error-in-subqueries-select-clause/11284/1 "2022-03-15T10:14:27Z")

</div>

I can’t get my head around this syntax error, been stuck for an hour. The error is near (SELECT AVG(invoice\_total) FROM invoices). It says wrong to use parentheses near select avg().

 ![Screen Shot 2022-03-15 at 9.02.03 pm](https://us1.discourse-cdn.com/flex020/uploads/codewithmosh/original/2X/6/62be85705cfe6c1a03cd70ebd9bbd2c94f37f9ee.png)

---

<div class="post-metadata">

**Author:** ![alex.cisija](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.codewithmosh.com/alex.cisija/32/298_2.png) [@alex.cisija](https://forum.codewithmosh.com/u/alex.cisija)\
**Post date:** [March 15, 2022, 11:44pm UTC](https://forum.codewithmosh.com/t/syntax-error-in-subqueries-select-clause/11284/2 "2022-03-15T23:44:09Z")

</div>

Hey, so sorry you got stuck! I think you may have to put a comma after `AS total_sales` and `AS average` because they are separate columns.

Let me know if that helps at all!

---

<div class="post-metadata">

**Author:** ![SAM](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.codewithmosh.com/sam/32/167_2.png) [@SAM](https://forum.codewithmosh.com/u/SAM)\
**Post date:** [March 18, 2022, 5:54am UTC](https://forum.codewithmosh.com/t/syntax-error-in-subqueries-select-clause/11284/3 "2022-03-18T05:54:05Z")

</div>

@srsr And the first parenthesis is not closed.
