Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/sql/70.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
python pyodbc正在使用此查询返回一个空列表_Python_Sql_Pyodbc - Fatal编程技术网

python pyodbc正在使用此查询返回一个空列表

python pyodbc正在使用此查询返回一个空列表,python,sql,pyodbc,Python,Sql,Pyodbc,此代码返回一个空列表。当我在应用程序中运行它时,我会得到很多记录。我在其他SQL查询中使用了这个基本脚本,它们工作得很好,但不是这个 数据库服务器是Sybase SQL Anywhere 12 import pyodbc cnxn = pyodbc.connect('DSN=dmserver') cursor = cnxn.cursor() cursor.execute("""select debtor_id ,name1 ,assign_id ,(select d

此代码返回一个空列表。当我在应用程序中运行它时,我会得到很多记录。我在其他SQL查询中使用了这个基本脚本,它们工作得很好,但不是这个

数据库服务器是Sybase SQL Anywhere 12

import pyodbc

cnxn = pyodbc.connect('DSN=dmserver')
cursor = cnxn.cursor()

cursor.execute("""select
  debtor_id
  ,name1
  ,assign_id
  ,(select
     dateformat(dateadd(minute,user_gmt_offset,string(act_date,' ',act_time)),'MM/DD/YYYY HH::NN::SS') 
       from
     dm.dbtract
       where
     item_no = (select max(item_no) from dm.dbtract as d2
               where
             left(comments,5) = 'AC11::'
               and       
             act_date < today(*) - 1
               and
             d2.debtor_id = dbtract.debtor_id)
       and
     dbtr.debtor_id = dbtract.debtor_id) as act_code_date_time
  ,(select
     list(phone,'~' ORDER by item_no asc)
       from
     dm.dbtrphon
       where
     status = 'A'
       and
     dbtrphon.debtor_id = dbtr.debtor_id) as Active_phone_list
from
  dm.dbtr
where
       (select
     count(*)
       from
     dm.dbtract
       where
     left(comments,5) = 'AC11::'
       and
     act_date < today(*) - 1
       and
     dbtr.debtor_id = dbtract.debtor_id) > 0
""")
while 1:
    row = cursor.fetchone()
    if not row:
        break
    print row

能否打开sql echo并粘贴生成的sql?能否打开sql echo并粘贴生成的sql?