使用数字查询ORACLE的JFreeChart [英] JFreeChart using numeric query ORACLE
问题描述
晚上好!
我有一个名为SWIMMER的表,并且需要查找(在名为TIME的NUMERIC字段中)给定时间间隔内某些值的出现次数(我正在使用Oracle10g). 我需要显示类似的内容:
I have a Table named SWIMMER, and need to find(in the NUMERIC field named TIME)the number of ocorrence of some values in a given interval(I am using Oracle10g). I need to show something like that:
23更高或相等的时间显示值300的HorizontalBar
22,3更高或等于TIME次要或等于23显示显示值为140的HorizontalBar
21,6更高或等于TIME次要或等于22,3显示HorizontalBar的值为15
20,9更高或等于TIME次要或等于21,6显示HorizontalBar的值为3
23 higher or equal TIME Shows HorizontalBar with value 300
22,3 higher or equal TIME minor or equal 23 Shows HorizontalBar with value 140
21,6 higher or equal TIME minor or equal 22,3 Shows HorizontalBar with value 15
20,9 higher or equal TIME minor or equal 21,6 Shows HorizontalBar with value 3
有可能会有这样的查询?我该如何组装该查询? (注意:符号是次要的或相等的,我不能在此处发布,因为它每次都会出错)
Its possible to have a query to have a return like that?How could i assembly that query? (Note: minor or equal are the Symbols,i can not post here because it is giving errors everytime)
最好的问候,
推荐答案
尝试类似这样的方法(这是一个sqlfiddle ):
Try something like this (Here is a sqlfiddle):
select case
when time >= 23 then '23 =< TIME'
when time < 23 and time >= 22.3 then '23 > TIME >= 22,3'
when time < 22.3 and time >= 21.6 then '22,3 > TIME >= 21,6'
when time < 21.6 and time >= 20.9 then '21,6 > TIME >= 20,9'
else '20,9 > TIME'
end || ' with value '|| count(*) v
from your_table
group by case
when time >= 23 then '23 =< TIME'
when time < 23 and time >= 22.3 then '23 > TIME >= 22,3'
when time < 22.3 and time >= 21.6 then '22,3 > TIME >= 21,6'
when time < 21.6 and time >= 20.9 then '21,6 > TIME >= 20,9'
else '20,9 > TIME'
end
和结果:
21,6 > TIME >= 20,9 with value 8
20,9 > TIME with value 4
22,3 > TIME >= 21,6 with value 6
23 > TIME >= 22,3 with value 15
23 =< TIME with value 66
更新:正如DavidAldrige所建议的,您可以有一个子查询:
UPDATE: As DavidAldrige suggested you can have a subquery:
select intrvl || ' with value '|| count(*) v
from
(select case
when time >= 23 then '23 =< TIME'
when time < 23 and time >= 22.3 then '23 > TIME >= 22,3'
when time < 22.3 and time >= 21.6 then '22,3 > TIME >= 21,6'
when time < 21.6 and time >= 20.9 then '21,6 > TIME >= 20,9'
else '20,9 > TIME'
end intrvl, time
from t)
group by intrvl
这篇关于使用数字查询ORACLE的JFreeChart的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!