我正在将我的MySQL数据库迁移到PostgreSQL。当连接数据库到我的Python脚本时,我得到一些语法错误。因此,您能否将此MySQL查询转换为PostgreSQL:
select ifnull((select ifnull(run_id,0) from searchbank order by run_id desc limit 0,1),0)
为了解释,我将代码分成子部分:(相同的作用域)
<?php
### part 1
connect_db(); // My db connection function - works fine
### part 2
/* lot of code without closing mysql connection - these lines works fine too */
### part 3
/* lot of statements like the following */
if( $statement ){
/* some code */
mysql_close