Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

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

Posted on 2005-04-06
3
Medium Priority
?
879 Views
Last Modified: 2008-01-09
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 ;
0
Comment
Question by:Geoff Millikan
3 Comments
 
LVL 6

Expert Comment

by:peyox
ID: 13720720
CONCAT((ROUND(SUM(check_amount)/23456)*100,2), '%')
should be:
CONCAT(ROUND((SUM(check_amount)/23456)*100,2), '%')
0
 

Author Comment

by:Geoff Millikan
ID: 13720967
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;
0
 
LVL 10

Accepted Solution

by:
kupra1 earned 300 total points
ID: 13721071
This doesn't look good to me.

>>> CONCAT(ROUND((SUM(check_amount)/23456)*100,2), '%')) AS 'Rank'

should be like this:
CONCAT(ROUND(((SUM(check_amount)/23456)*100), 2), '%') AS 'Rank'
0

Featured Post

Receive 1:1 tech help

Solve your biggest tech problems alongside global tech experts with 1:1 help.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

By, Vadim Tkachenko. In this article we’ll look at ClickHouse on its one year anniversary.
In this article, we’ll look at how to deploy ProxySQL.
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
Suggested Courses
Course of the Month10 days, 10 hours left to enroll

572 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question