-- Formatting purpose
SET LINESIZE 200
COLUMN 'Pharmaceutical Companies' FORMAT a25
COLUMN 'Drug Count' FORMAT a10
-- Code
SELECT PHARNAME AS "Pharmaceutical Companies", COUNT (tradename) AS "Drug Count"
FROM DRUG
GROUP BY PHARNAME
HAVING COUNT (TRADENAME) = (SELECT MAX ("Drug Count")
FROM (SELECT COUNT (TRADENAME) AS "Drug Count" FROM DRUG
GROUP BY PHARNAME));
Above this is my set of code to get certain values out of my database. However, the results printed are
上面是我的一组代码,用于从我的数据库中获取某些值。但是,打印的结果是
Pharmaceutical Companies Drug Count
------------------------- ----------
Medmed Shine ##########
If i remove the formatting purpose, it will show
如果我删除格式化目的,它将显示
Pharmaceutical Companies Drug Count
------------------------------ ----------
Medmed Shine 14
I have tried adjusting the format size but it still displays as ########
我试过调整格式大小,但它仍显示为########
1 个解决方案
#1
aXXX
formats columns as text, but you are printing numbers. You can use 9
s to format a column as a number, which also lets you use commas to separate thousands:
aXXX将列格式化为文本,但您正在打印数字。您可以使用9s将列格式化为数字,这也允许您使用逗号分隔数千:
SET LINESIZE 200
COLUMN 'Pharmaceutical Companies' FORMAT a25
COLUMN 'Drug Count' FORMAT 999,999,999,999
#1
aXXX
formats columns as text, but you are printing numbers. You can use 9
s to format a column as a number, which also lets you use commas to separate thousands:
aXXX将列格式化为文本,但您正在打印数字。您可以使用9s将列格式化为数字,这也允许您使用逗号分隔数千:
SET LINESIZE 200
COLUMN 'Pharmaceutical Companies' FORMAT a25
COLUMN 'Drug Count' FORMAT 999,999,999,999