是否可以使用续集来执行这样的查询:
select (select count(*) from users where blah = 'blah') as "users",
(select count(*) from contacts where blah = 'blah') as "contacts"
Run Code Online (Sandbox Code Playgroud)
我知道我可以使用续集一次执行这些查询,但我想同时执行它们.
我有一张桌子transactions
id | bigint | NOT NULL DEFAULT nextval('transactions_id_seq'::regclass)
transaction_id | bigint | NOT NULL
middleware_id | text |
opname | optype | NOT NULL
created_at | timestamp without time zone | NOT NULL
finished_at | timestamp without time zone |
request | jsonb | NOT NULL
answer | jsonb |
Run Code Online (Sandbox Code Playgroud)
其中请求可以包含以下数据:
{ plugin_id: string, item_src_id: string, item_dst_id: string, payload: {}}
或
{ plugin_id: string, item_id: string, payload: {}}
item_id我可以使用纯 SQL来选择事务列表:
SELECT id, request
FROM transactions
WHERE 'BEX456' …Run Code Online (Sandbox Code Playgroud) 我正在学习Ruby和续集,并尝试制作一些表格.
我希望在PostgreSQL数据库中以UTC格式保存我的时间值.所以我做了一张桌子
db.create_table :TestTable1 do
Timestamp :field1
end
Run Code Online (Sandbox Code Playgroud)
但我明白了
field1 | timestamp without time zone | | plain |
Run Code Online (Sandbox Code Playgroud)
我希望我在数据库中的价值有严格的依据.所以我想用UTC强制一切.我认为应该有一种方法来制作TIMESTAMP WITH TIME ZONE专栏.我怎样才能做到这一点?