i have problem integrating not exists in sql query. let me explain problem in detail have 4 tables : branch_details , transactions,branch_order_relation , branch_pincode_relation.
here sql query
private static final string select_orders_by_branch = "select transaction_id,source_id,destination_id transactions,branch_pincode_relation,branch_details,branch_order_relation branch_details.branch_email = ? , branch_details.branch_id = branch_pincode_relation.branch_id , branch_pincode_relation.origin_pincode = transactions.start_pin , transactions.parent_transaction_id not null , transactions.order_status = "+jiffieconstants.payment_success;
there transaction_id of transactions table exists in branch_order_relation (as order_id). if transaction_id present in branch_order_relation should not select it. otherwise need select it. can please integrate in above sql query. tried , google not able come solution
i modified query
private static final string select_orders_by_branch = "select transaction_id,source_id,destination_id transactions,branch_pincode_relation,branch_details branch_details.branch_email = ? , branch_details.branch_id = branch_pincode_relation.branch_id , branch_pincode_relation.origin_pincode = transactions.start_pin , transactions.parent_transaction_id not null , transactions.order_status = "+jiffieconstants.payment_success+" , not exists (select null branch_order_relation branch_order_relation.order_id = transactions.transaction_id)";
and working. thanks!
Comments
Post a Comment