Joh*_*Doe 5 postgresql select conditional-statements
说,有两张桌子。一个包含具有长文本值的字段(例如foobarbaz),另一个包含较短的值(foobar和someothertext)。我想从具有以下条件的两个表中检索值:文本不能相等,但长字符串的开头必须与短字符串匹配。在 Postgres 中是否有(整洁的)方法来做到这一点?提前致谢。
怎么样:
SELECT <whatever>
FROM <your tables>
WHERE one_field <> the_other_field
AND position(the_other_field in one_field) = 1;
Run Code Online (Sandbox Code Playgroud)
请参阅字符串函数和运算符。
| 归档时间: |
|
| 查看次数: |
8825 次 |
| 最近记录: |