[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

SF.net SVN: ledger-smb:[3023] trunk/sql/modules/Drafts.sql



Revision: 3023
          http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=3023&view=rev
Author:   einhverfr
Date:     2010-07-01 20:01:35 +0000 (Thu, 01 Jul 2010)

Log Message:
-----------
Performance fixes to Drafts.sql

Modified Paths:
--------------
    trunk/sql/modules/Drafts.sql

Modified: trunk/sql/modules/Drafts.sql
===================================================================
--- trunk/sql/modules/Drafts.sql	2010-07-01 14:19:54 UTC (rev 3022)
+++ trunk/sql/modules/Drafts.sql	2010-07-01 20:01:35 UTC (rev 3023)
@@ -40,11 +40,12 @@
 			) trans
 		JOIN acc_trans line ON (trans.id = line.trans_id)
 		JOIN chart ON (line.chart_id = chart.id)
+           LEFT JOIN voucher v ON (v.trans_id = trans.id)
 		WHERE (in_from_date IS NULL or trans.transdate >= in_from_date)
 			AND (in_to_date IS NULL 
 				or trans.transdate <= in_to_date)
 			AND trans.approved IS FALSE
-			AND trans.id NOT IN (select trans_id from voucher)
+			AND v.id IS NULL
 		GROUP BY trans.id, trans.transdate, trans.description, trans.reference
 		HAVING (in_with_accno IS NULL or in_with_accno = 
 			ANY(as_array(chart.accno)))


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.