sql syntax error. Attempting to round to 2 places

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
stuckne1
Forum Newbie
Posts: 7
Joined: Sat Nov 27, 2010 10:51 am

sql syntax error. Attempting to round to 2 places

Post by stuckne1 »

I'm attempting to round my result to 2 places. After using google, this is what I came up with. It says I have a syntax error though. Help greatly appreciated.

Code: Select all

SELECT ROUND(SUM(amount),2) / (SELECT COUNT(roommate_id)  
FROM t_roommates
WHERE room_id = 1)
FROM t_roommates
JOIN t_transactions ON
t_roommates.roommate_id = t_transactions.roommate_id
WHERE room_id = 1
Post Reply