none
SQL 語法寫進陣列中 RRS feed

  • 問題

  • 目前正在使用CHART,因此有些資料必須從SQL中得到,想請腳一下如何把我所寫的SQL放進陣列中?

    給個SQL給大家參考:)   謝謝大家囉!!!

    Select * From 
    (Select COUNT(p.age) as '19歲以下' From Patient p, Activity a, HData hd Where (a.act_num = hd.act_num) And (p.num = hd.num) And p.age <19) as table1, 
    (Select COUNT(p.age) as '20-24歲' From Patient p, Activity a, HData hd Where (a.act_num = hd.act_num) And (p.num = hd.num) And p.age >=20 And p.age <25) as table2, 
    (Select COUNT(p.age) as '25-29歲' From Patient p, Activity a, HData hd Where (a.act_num = hd.act_num) And (p.num = hd.num) And p.age >=25 And p.age <30) as table3, 
    (Select COUNT(p.age) as '30-34歲' From Patient p, Activity a, HData hd Where (a.act_num = hd.act_num) And (p.num = hd.num) And p.age >=30 And p.age <35) as table4
    


    2011年10月12日 下午 05:54

所有回覆