Link to home
Start Free TrialLog in
Avatar of Geoff Millikan
Geoff MillikanFlag for United States of America

asked on

Using ROUND(x) generates ERROR 1241: Operand should contain 1 column(s)

I am getting the below error when using the below query.  What do I need to change in my query?  This error started taking place when I added the ROUND() function which I added so that the math would round out to two decimal places instaed of the existing four places e.g. $234.3456 and I want it to be $234.35.

ERROR 1241: Operand should contain 1 column(s)

SELECT DISTINCT account_name, COUNT(return_code), CONCAT('$',SUM(check_amount)), CONCAT((ROUND(SUM(check_amount)/23456)*100,2), '%') AS 'Rank' FROM `bcf_collections` WHERE (locate('296',pcid)>0 OR locate('---',account_name)>0) AND pos_date BETWEEN '2005-03-06' AND '2005-04-06' GROUP BY account_name ORDER BY 'Rank'DESC ;
Avatar of peyox
peyox
Flag of Poland image

CONCAT((ROUND(SUM(check_amount)/23456)*100,2), '%')
should be:
CONCAT(ROUND((SUM(check_amount)/23456)*100,2), '%')
Avatar of Geoff Millikan

ASKER

Well, we're getting a new error code now with the new query below-

ERROR 1064: You have an error in your SQL syntax;

SELECT DISTINCT account_name, COUNT(return_code),
CONCAT('$',SUM(check_amount)),
CONCAT(ROUND((SUM(check_amount)/23456)*100,2), '%')) AS 'Rank'
FROM `bcf_collections` WHERE (locate('296',pcid)>0 OR locate('---',account_name)>0) AND
pos_date BETWEEN '2005-03-06' AND '2005-04-06'
GROUP BY account_name
ORDER BY  'Rank' DESC;
ASKER CERTIFIED SOLUTION
Avatar of kupra1
kupra1

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial