我有我試圖優化對PostgreSQL 9.2的查詢: select coalesce(max(id),0) as m from tbl
它需要的永遠跑,所以我想我除了它需要返回0如果在表中沒有行可以重寫它作爲 select id from tbl order by id desc limit 1
。我已經嘗試了一些案例陳述的組合,但他們似乎並不奏效。有什麼建議麼? 計劃一個空表: Aggr
我正在尋找一種方法來取代int字段中的所有空值val,其中0(零)產生自 NATURAL FULL JOIN在兩個表上。例如: table1
num | name
-----+------
1 | a
2 | b
3 | c
和表2: num | value
-----+-------
1 | 40
3 | 50
5 | 60
OpenBSD的,PostgreSQL9.2,python2.7 試圖從蟒命令行導入psycopg2模塊: Python 2.7.3 (default, Aug 3 2012, 05:33:56)
[GCC 4.2.1 20070719 ] on openbsd5
Type "help", "copyright", "credits" or "license" for more informa