Hi there, Not sure if I missed something obvious or the code is behaving strangely. i have below simplified table, i have added 3 records with all voucher_id=1 and txn_source='INV', now I want to make a select statement as following, the 2 select() calls have different results (inv_paid_count=3, inv_paid_count2=0. 0 is what I expected) when i interchange the order of the select criteria. Any help is much appreciated.
db.define_table('general_ledger', Field('txn_date', 'date', label='Transaction Date'), Field('merchant', label='Customer/Vendor'), Field('txn_desc', label='Transaction Description'), Field('txn_amount', 'double', label='Transaction Amount'), Field('txn_source', label='Transaction source'), Field('voucher_id'), Field('which_entry', readable=False, writable=False), format='%(txn_desc)s') def test_gl_sql(): inv_paid_count = db(db.general_ledger.txn_source=='INV_PAID' and db.general_ledger.voucher_id==1).count() print 'inv_paid_count= %s' % inv_paid_count inv_paid_count2 = db(db.general_ledger.voucher_id==1 and db.general_ledger.txn_source=='INV_PAID').count() print 'inv_paid_count2= %s' % inv_paid_count2 print db(idb.general_ledger.voucher_id==1 and db.general_ledger.txn_source=='INV_PAID').select() return locals() -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.