gpt4 book ai didi

postgresql - Postgres/hstore : how to get IDs of rows with certain key in their hstore field?

转载 作者:行者123 更新时间:2023-11-29 12:09:07 25 4
gpt4 key购买 nike

我正在查询 pgsql 数据库以查找在 hstore 字段中具有特定键的行:

select DISTINCT
from (select id, exist(data, ‘exercise_quiz’) key_exists
from user_tracking) x
where key_exists = true;

它工作正常,但我需要打印它返回的相应行的 ID。我可以使用此命令执行此操作吗?

最佳答案

使用运算符 hstore ?文本 (does hstore contain key?) :

select id
from user_tracking
where data ? 'exercise_quiz';

关于postgresql - Postgres/hstore : how to get IDs of rows with certain key in their hstore field?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46333056/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com