Not in ,in替换解决文字not EXISTS,EXISTS

来源:互联网 发布:phpdisk无法连接数据库 编辑:程序博客网 时间:2024/06/05 06:02
set statistics time onselect * from t_jiejiansheet where 1=1 and ( jiejiansheet_id in (select jiejiansheet_id_list from t_invoice_payment where invoice = '未开具') or ( jiejiansheet_id not in (select jiejiansheet_id_list from t_invoice_payment) and invoice = '未开具'))set statistics time off


SQL Server 执行时间:
   CPU 时间 = 0 毫秒,耗费时间 = 0 毫秒。

(所影响的行数为 303 行)


SQL Server 执行时间:
   CPU 时间 = 859 毫秒,耗费时间 = 1054 毫秒。

SQL Server 执行时间:
   CPU 时间 = 859 毫秒,耗费时间 = 1061 毫秒。

SQL Server 执行时间:

   CPU 时间 = 859 毫秒,耗费时间 = 1061 毫秒。


set statistics time onselect * from t_jiejiansheet where 1=1 and ( EXISTS (select jiejiansheet_id_list from t_invoice_payment where invoice = '未开具' and t_invoice_payment.jiejiansheet_id_list=t_jiejiansheet.jiejiansheet_id) or ( not EXISTS (select jiejiansheet_id_list from t_invoice_payment where t_invoice_payment.jiejiansheet_id_list=t_jiejiansheet.jiejiansheet_id ) and invoice = '未开具'))set statistics time off


SQL Server 执行时间:
   CPU 时间 = 0 毫秒,耗费时间 = 0 毫秒。

(所影响的行数为 303 行)


SQL Server 执行时间:
   CPU 时间 = 16 毫秒,耗费时间 = 203 毫秒。

SQL Server 执行时间:
   CPU 时间 = 16 毫秒,耗费时间 = 215 毫秒。

SQL Server 执行时间:
   CPU 时间 = 16 毫秒,耗费时间 = 215 毫秒。




原创粉丝点击