I want to add string with selected count value from table.
SELECT
CONCAT(COUNT(*),' ', if(COUNT(*) > 1, 'rows','row')) AS NoOfRows
FROM myTable;
Output :
NoOfRows
BLOB
Expected :
NoOfRows
10 rows
What am I doing wrong?
Maybe you have to use cast
function.
select
concat(cast(count(*) as char(10)), ' ', if(count(*) > 1, 'rows','row')) as NoOfRows
from myTable;
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.