KyleWhite97
KyleWhite97

Reputation: 13

Rounding Off A Number In SQL

SELECT ActorName,ShowName,ROUND((ActorRate)*ShowDuration)/60,2 AS [TotalEarnings]
FROM (tblActors
INNER JOIN tblRoles
ON tblActors.ActorID=tblRoles.ActorID)
INNER JOIN tblShows
ON tblShows.ShowID=tblRoles.ShowID
ORDER BY ActorName 

Looked at the previous example but it tells me there's a duplicate bracket every time I run it with a bracket at the end of ROUND. Please could someone help me round this answer off to 2 decimal places.

Upvotes: 1

Views: 30

Answers (1)

Gustav
Gustav

Reputation: 55906

It should read:

SELECT ActorName, ShowName, ROUND(ActorRate*ShowDuration/60, 2) AS [TotalEarnings] 
FROM (tblActors 
INNER JOIN tblRoles 
ON tblActors.ActorID=tblRoles.ActorID) 
INNER JOIN tblShows 
ON tblShows.ShowID=tblRoles.ShowID 
ORDER BY ActorName 

Upvotes: 1

Related Questions