Re: 分類付き m_sakumotsu ほぼ最終仕様

このトピックの投稿一覧へ

なし Re: 分類付き m_sakumotsu ほぼ最終仕様

msg# 1.1.1.1.1.1
depth:
5
前の投稿 - 次の投稿 | 親投稿 - 子投稿.1 | 投稿日時 2010.11.29 11:03
OhYeah!  管理人   投稿数: 983 オンライン
現在のバージョンでは cid はユニーク値になっているので、cid を idsaku に使用しても全く問題ないことに気づきました。ってことで、spec.sakumotsu, m_sakumotsu ともに cid を idsaku に変更し、m_tekiyo の idsaku にもこの値をそのまま書き戻すように修正しました。

>kabe さん
この作物マスターを使用する場合、m_tekiyo の idsaku の型を char[10] に変更してください。

なお、cid が idsaku に変更されたので、上位分類や栽培条件付き作物名を調べるクエリーは、下記のようになります。

1. 「デコポン」の上位分類を調べる
--/d
drop table if exists tsakumotsu;
create temp table tsakumotsu as select idsaku from spec.csakumotsu where concat('/', sakumotsu, betsumei) regexp '(^|/)デコポン(/|$)';
select * from spec.csakumotsu where
  idsaku in (select substr(idsaku, 1, 2) || '00000000' from tsakumotsu) or
  idsaku in (select substr(idsaku, 1, 4) || '000000' from tsakumotsu) or
  idsaku in (select substr(idsaku, 1, 5) || '00000' from tsakumotsu) or
  idsaku in (select substr(idsaku, 1, 8) || '00' from tsakumotsu) or
  idsaku in (select idsaku from tsakumotsu)
order by idsaku;


2. 「ねぎ」の栽培条件付き作物名を調べる
select * from spec.csakumotsu
where idsaku like (select substr(idsaku, 1, 8)||'%' from spec.csakumotsu where concat('/', sakumotsu, betsumei) regexp '(^|/)ねぎ(/|$)')
order by idsaku;
投票数:7 平均点:7.14

投稿ツリー

  条件検索へ