分類付き m_byochu
OhYeah!
投稿数: 983
オンライン

病害虫タブの病害虫選択ダイアログボックスにも使用するかどうかは別として、作物タブや定型処理タブの病害虫選択ダイアログボックスで雑草・病害・害虫・鳥獣による絞込ができるように、分類付きの m_byochu を作ってみました。例外処理がいくつか必要なので、登録内容が変わると例外処理部分は若干修正が必要になるかもしれません。
m_kihon は作成済み、m_tekiyo は中間テーブルを作成済みという前提です。m_tekiyo の中間テーブルの名前が異なる場合は、m_tekiyo 部分を中間テーブルの名前に変更してください。
(2) 害虫については、"mokuteki in ('誘引', '交尾阻害') or " の部分を削除しても同じ結果が得られ、わずかに高速になります。が、これも新剤の登録内容によっては必要になるかもしれないので、あえて残してあります。
(3) UTF-8 のせいか、order by byochu で「黄」や「黒」で始まる病害名が一番最後になってしまうのがちょっと違和感があります。ふりがな・別名フィールドを作っておいて、病害虫辞書から逆変換して、ふりがなでソートした方が良いかもしれません。
m_kihon は作成済み、m_tekiyo は中間テーブルを作成済みという前提です。m_tekiyo の中間テーブルの名前が異なる場合は、m_tekiyo 部分を中間テーブルの名前に変更してください。
--/d
drop table if exists t_byochu;
create temp table t_byochu as select distinct byochu from m_tekiyo order by byochu;
drop table if exists m_byochu;
create table m_byochu (idbyochu integer primary key autoincrement, byochu varchar unique, cid integer);
begin transaction;
insert into m_byochu (byochu, cid) select byochu, 0 from t_byochu where ifnullstr(byochu, '-') != '-';
update m_byochu set cid = 4 where byochu in (select distinct byochu from m_tekiyo where mokuteki = '忌避' or bango in (select bango from m_kihon where koka like '%忌避%'));
update m_byochu set cid = 3 where byochu in (select distinct byochu from m_tekiyo where mokuteki in ('誘引', '交尾阻害') or bango in (select bango from m_kihon where yoto like '殺虫%' or koka like '%誘引' or koka like '%殺虫%'));
update m_byochu set cid = 3 where byochu like '%ナメクジ';
update m_byochu set cid = 1 where byochu like '%雑草%' or byochu in (select distinct byochu from m_tekiyo where bango in (select bango from m_kihon where yoto = '除草剤'));
update m_byochu set cid = 2 where byochu like '%病%' or byochu like'%症%' or byochu like '%菌%' or byochu like '%腐%' or byochu like '%タケ';
update m_byochu set cid = 0 where byochu like '活性化%' or byochu like '%覚醒%';
update m_byochu set cid = 4 where byochu in ('野ウサギ', '野ソ');
commit;
drop table if exists t_byochu;
(1) t_byochu を作らずに、m_tekiyo から直接 insert 可能ですが、t_byochu からの方がわずかに速かったので、一応テンポラリテーブルを作成するようにしています。(2) 害虫については、"mokuteki in ('誘引', '交尾阻害') or " の部分を削除しても同じ結果が得られ、わずかに高速になります。が、これも新剤の登録内容によっては必要になるかもしれないので、あえて残してあります。
(3) UTF-8 のせいか、order by byochu で「黄」や「黒」で始まる病害名が一番最後になってしまうのがちょっと違和感があります。ふりがな・別名フィールドを作っておいて、病害虫辞書から逆変換して、ふりがなでソートした方が良いかもしれません。
投票数:2
平均点:5.00
投稿ツリー
-
ACFinderでの作物名コードの扱いについて (sugak, 2010.10.25 19:14)
-
Re: ACFinderでの作物名コードの扱いについて (kabe, 2010.10.25 20:29)
-
ACFinder 101023test版 (kabe, 2010.10.25 23:53)
-
Re: ACFinderでの作物名コードの扱いについて (OhYeah!, 2010.10.26 02:07)
-
Re: ACFinderでの作物名コードの扱いについて (OhYeah!, 2010.10.26 17:52)
-
Re: ACFinderでの作物名コードの扱いについて (OhYeah!, 2010.10.26 19:15)
-
Re: ACFinderでの作物名コードの扱いについて (OhYeah!, 2010.10.26 23:34)
-
Re: ACFinderでの作物名コードの扱いについて (kabe, 2010.10.27 18:33)
-
Re: ACFinderでの作物名コードの扱いについて (kabe, 2010.10.30 22:28)
-
Re: ACFinderでの作物名コードの扱いについて (OhYeah!, 2010.10.31 00:45)
-
ACFinder 101031test版 (kabe, 2010.10.31 23:37)
-
Re: ACFinder 101031test版 (kabe, 2010.11.01 16:29)
-
Re: ACFinder 101031test版 (OhYeah!, 2010.11.01 18:31)
-
-
-
-
-
-
Re: ACFinderでの作物名コードの扱いについて (OhYeah!, 2010.10.28 11:04)
-
FAMIC からの返信 (OhYeah!, 2010.11.01 08:39)
-
-
-
-
新作物マスター案 (OhYeah!, 2010.11.01 10:44)
-
Re: 新作物マスター案 (kabe, 2010.11.04 23:10)
-
Re: 新作物マスター案 (OhYeah!, 2010.11.05 00:31)
-
-
-
新病害虫マスター案 (OhYeah!, 2010.11.01 11:20)
-
Re: 新病害虫マスター案 (OhYeah!, 2010.11.01 19:20)
-
Re: 新病害虫マスター案 (kabe, 2010.11.01 22:29)
-
Re: 新病害虫マスター案 (OhYeah!, 2010.11.02 00:22)
-
-
Re: 新病害虫マスター案 (OhYeah!, 2010.11.02 02:03)
-
Re: 新病害虫マスター案 (OhYeah!, 2010.11.02 19:54)
-
-
-
分類付き m_byochu (OhYeah!, 2010.11.03 01:25)
-
Re: 分類付き m_byochu (OhYeah!, 2010.11.03 12:04)
-
Re: 分類付き m_byochu (kabe, 2010.11.03 21:20)
-
Re: 分類付き m_byochu (OhYeah!, 2010.11.03 22:01)
-
Re: 分類付き m_byochu (OhYeah!, 2010.11.03 22:45)
-
Re: 分類付き m_byochu (OhYeah!, 2010.11.03 23:59)
-
-
Re: 分類付き m_byochu (OhYeah!, 2010.11.10 00:30)
-
Re: 分類付き m_byochu (OhYeah!, 2010.11.10 09:14)
-
-
-
-
病害虫分類及び害虫グループ付き m_byochu (OhYeah!, 2010.11.03 17:12)
-
Re: 病害虫分類及び害虫グループ付き m_byochu (OhYeah!, 2010.11.03 18:34)
-
Re: 病害虫分類及び害虫グループ付き m_byochu (OhYeah!, 2010.11.04 00:39)
-
Re: 病害虫分類及び害虫グループ付き m_byochu (OhYeah!, 2010.11.04 00:43)
-
Re: 病害虫分類及び害虫グループ付き m_byochu (OhYeah!, 2010.11.08 23:40)
-
-
-
-
-