###前提・実現したいこと
ここに質問したいことを詳細に書いてください
(例)PHP(CakePHP)で●●なシステムを作っています。
■■な機能を実装中に以下のエラーメッセージが発生しました。
###発生している問題・エラーメッセージ
エラーメッセージ
###該当のソースコード
ここにご自身が実行したソースコードを書いてください
###試したこと
課題に対してアプローチしたことを記載してください
###補足情報(言語/FW/ツール等のバージョンなど)
より詳細な情報
###前提・実現したいこと
Seasar2 を用いて、Web 開発をしております。
SQLファイルを作成し SQL を実行する形なのですが、
以下の SQL がうまく実行されません。
select文の from句でのサブクエリ?ネスト?が
あまり自信ありません。
少しでも気になった点があれば、教えてください。
よろしくお願いします。
なお、データベースは MySQL を用いています。
###発生している問題・エラーメッセージ
SQL が実行されたきり、応答がない。(フリーズ) おそらく、SQL 文が不正なため。
###該当のソースコード
MySQL
1select 2 a.name 3 ,a.grp_cd 4 ,'1' as kaiso 5 ,a.oya_grp_cd 6 ,coalesce(b.cnt, 0) + coalesce(d.cnt, 0) 7 ,(coalesce(b.cnt, 0) + coalesce(d.cnt, 0)) as oya_cnt 8from ( 9 select 10 '全国' as name 11 ,'001' as grp_cd 12 ,'' as oya_grp_cd 13 from amc.t_shop s 14 group by grp_cd 15) as a 16 left join ( 17 select 18 count(*) as cnt, 19 '001' as grp_cd 20 from ( 21 select 22 ttd.server_code as server_code, 23 ttd.item1 as item1 24 from region.t_tatemono_data ttd 25 where date_format(ttd.item108, '%Y-%m-%d') between /*startYmd_alert*/'2017-10-01' and /*endYmd_alert*/'2017-10-31' 26 ) as abc 27 left join region.opt_approach_info oa 28 on oa.server_code=abc.server_code and oa.tatemono_code=abc.item1 and oa.charge_shop_code <> '000PAR' 29 left join region.opt_visit_history ov 30 on ov.id = oa.last_visit_history_id 31 )as b on a.grp_cd = b.grp_cd 32 33 left join ( 34 select 35 count(*) as cnt, 36 '001' as grp_cd 37 from ( 38 select 39 ob.id as id 40 from region.opt_building ob 41 where date_format(ob.regist_date, '%Y-%m-%d') between /*startYmd_alert*/'2017-10-01' and /*endYmd_alert*/'2017-10-31' 42 ) as abc 43 left join region.opt_approach_info oa 44 on oa.opt_building_id=abc.id and oa.charge_shop_code <> '000PAR' 45 left join region.opt_visit_history ov 46 on ov.id = oa.last_visit_history_id 47 )as d on a.grp_cd = d.grp_cd 48order by grp_cd
###試したこと
課題に対してアプローチしたことを記載してください
###補足情報(言語/FW/ツール等のバージョンなど)
Seasar2
Java
eclipse
###前提・実現したいこと
Seasar2 を用いて、Web 開発をしております。
SQLファイルを作成し SQL を実行する形なのですが、
以下の SQL がうまく実行されません。
select文の from句でのサブクエリ?ネスト?が
あまり自信ありません。
少しでも気になった点があれば、教えてください。
よろしくお願いします。
なお、データベースは MySQL を用いています。
###発生している問題・エラーメッセージ
SQL が実行されたきり、応答がない。(フリーズ) おそらく、SQL 文が不正なため。
###該当のソースコード
MySQL
1select 2 a.name 3 ,a.grp_cd 4 ,'1' as kaiso 5 ,a.oya_grp_cd 6 ,coalesce(b.cnt, 0) + coalesce(d.cnt, 0) 7 ,(coalesce(b.cnt, 0) + coalesce(d.cnt, 0)) as oya_cnt 8from ( 9 select 10 '全国' as name 11 ,'001' as grp_cd 12 ,'' as oya_grp_cd 13 from amc.t_shop s 14 group by grp_cd 15) as a 16 left join ( 17 select 18 count(*) as cnt, 19 '001' as grp_cd 20 from ( 21 select 22 ttd.server_code as server_code, 23 ttd.item1 as item1 24 from region.t_tatemono_data ttd 25 where date_format(ttd.item108, '%Y-%m-%d') between /*startYmd_alert*/'2017-10-01' and /*endYmd_alert*/'2017-10-31' 26 ) as abc 27 left join region.opt_approach_info oa 28 on oa.server_code=abc.server_code and oa.tatemono_code=abc.item1 and oa.charge_shop_code <> '000PAR' 29 left join region.opt_visit_history ov 30 on ov.id = oa.last_visit_history_id 31 )as b on a.grp_cd = b.grp_cd 32 33 left join ( 34 select 35 count(*) as cnt, 36 '001' as grp_cd 37 from ( 38 select 39 ob.id as id 40 from region.opt_building ob 41 where date_format(ob.regist_date, '%Y-%m-%d') between /*startYmd_alert*/'2017-10-01' and /*endYmd_alert*/'2017-10-31' 42 ) as abc 43 left join region.opt_approach_info oa 44 on oa.opt_building_id=abc.id and oa.charge_shop_code <> '000PAR' 45 left join region.opt_visit_history ov 46 on ov.id = oa.last_visit_history_id 47 )as d on a.grp_cd = d.grp_cd 48order by grp_cd
###試したこと
課題に対してアプローチしたことを記載してください
###補足情報(言語/FW/ツール等のバージョンなど)
より詳細な情報
###前提・実現したいこと
Seasar2 を用いて、Web 開発をしております。
SQLファイルを作成し SQL を実行する形なのですが、
以下の SQL がうまく実行されません。
select文の from句でのサブクエリ?ネスト?が
あまり自信ありません。
少しでも気になった点があれば、教えてください。
よろしくお願いします。
なお、データベースは MySQL を用いています。
###発生している問題・エラーメッセージ
SQL が実行されたきり、応答がない。(フリーズ) おそらく、SQL 文が不正なため。
###該当のソースコード
MySQL
1select 2 a.name 3 ,a.grp_cd 4 ,'1' as kaiso 5 ,a.oya_grp_cd 6 ,coalesce(b.cnt, 0) + coalesce(d.cnt, 0) 7 ,(coalesce(b.cnt, 0) + coalesce(d.cnt, 0)) as oya_cnt 8from ( 9 select 10 '全国' as name 11 ,'001' as grp_cd 12 ,'' as oya_grp_cd 13 from amc.t_shop s 14 group by grp_cd 15) as a 16 left join ( 17 select 18 count(*) as cnt, 19 '001' as grp_cd 20 from ( 21 select 22 ttd.server_code as server_code, 23 ttd.item1 as item1 24 from region.t_tatemono_data ttd 25 where date_format(ttd.item108, '%Y-%m-%d') between /*startYmd_alert*/'2017-10-01' and /*endYmd_alert*/'2017-10-31' 26 ) as abc 27 left join region.opt_approach_info oa 28 on oa.server_code=abc.server_code and oa.tatemono_code=abc.item1 and oa.charge_shop_code <> '000PAR' 29 left join region.opt_visit_history ov 30 on ov.id = oa.last_visit_history_id 31 )as b on a.grp_cd = b.grp_cd 32 33 left join ( 34 select 35 count(*) as cnt, 36 '001' as grp_cd 37 from ( 38 select 39 ob.id as id 40 from region.opt_building ob 41 where date_format(ob.regist_date, '%Y-%m-%d') between /*startYmd_alert*/'2017-10-01' and /*endYmd_alert*/'2017-10-31' 42 ) as abc 43 left join region.opt_approach_info oa 44 on oa.opt_building_id=abc.id and oa.charge_shop_code <> '000PAR' 45 left join region.opt_visit_history ov 46 on ov.id = oa.last_visit_history_id 47 )as d on a.grp_cd = d.grp_cd 48order by grp_cd
###試したこと
課題に対してアプローチしたことを記載してください
###補足情報(言語/FW/ツール等のバージョンなど)
Seasar2
Java
eclipse
回答2件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2017/10/29 23:48