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

さらに、cid を間違えないようにしました。
まず、これで spec.cbyochu テーブルを作成します。cid は自由に付け直しても大丈夫です。
次に、これで m_byochu テーブルを作成します。
まず、これで spec.cbyochu テーブルを作成します。cid は自由に付け直しても大丈夫です。
--/d
drop table if exists spec.cbyochu;
create table spec.cbyochu (cid integer primary key, cname varchar unique);
begin transaction;
insert into spec.cbyochu values(1, '病害');
insert into spec.cbyochu values(2, '害虫');
insert into spec.cbyochu values(3, '雑草');
insert into spec.cbyochu values(4, '鳥獣');
insert into spec.cbyochu values(5, 'その他');
commit;
次に、これで m_byochu テーブルを作成します。
--/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, (select cid from spec.cbyochu where cname = 'その他') as cid from t_byochu where ifnullstr(byochu, '-') != '-';
--分類処理
update m_byochu set cid = (select cid from spec.cbyochu where cname = '鳥獣') 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 = (select cid from spec.cbyochu where cname = '害虫') 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 = (select cid from spec.cbyochu where cname = '雑草') 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 = (select cid from spec.cbyochu where cname = '病害') where byochu like '%病%' or byochu like'%症%' or byochu like '%菌%' or byochu like '%腐%' or byochu like '%タケ';
update m_byochu set cid = (select cid from spec.cbyochu where cname = 'その他') where byochu like '%活性化%' or byochu like '%覚醒%';
--分類例外処理
update m_byochu set cid = (select cid from spec.cbyochu where cname = '害虫') where byochu like '%ナメクジ' or byochu like '%ハダニ%';
update m_byochu set cid = (select cid from spec.cbyochu where cname = '鳥獣') where byochu in ('イノシシ', 'カモシカ', 'ニホンジカ', 'モグラ', '野ウサギ', '野ソ', '害獣');
commit;
投票数: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)
-
-
-
-
-