私はpostgresバージョン8.3(greenplum)を使用しています。私はcol_nameと呼ばれる単一の列の2つのテーブルを比較しようとしています。私が必要とするのは、両方の列の行の値を比較する部分文字列です。値はxx.yyy.zzzです。私は最初の部分、すなわち 'xx'を抜き出し、その後に '.yyy.zzz'を切り捨てたい。私は最初の期間に遭遇するまで、文字列の2つの行を比較したいだけです。文字列xxの部分の長さが文字数で変化する可能性があります。postgres string compare
私は、次のロジックを使用していますが、それは動作していない理由を私は見カント:
select
distinct x.col_name,
x.col_num
from table_A x
left outer join table_b y
on
regexp_matches((x.col_name,'^(?:([^.]+)\.?){1}',1),(y.col_name,'^(?:([^.]+)\.?){1}', 1))
and x.col_num=y.col_num;
私はこのエラーを取得しています:
ERROR: function regexp_matches(record, record) does not exist LINE 36: regexp_matches((x.col_name,'^(?:([^.]+).?){1}', 1),(y.... ^HINT: No function matches the given name and argument types. You may need to add explicit type casts. ********** Error **********
ERROR: function regexp_matches(record, record) does not exist SQL state: 42883 Hint: No function matches the given name and argument types. You may need to add explicit type casts. Character: 917
誰も私を助けることはできますか?
ありがとうございます!