Filter on two separate date field ranges using between function

Database
Enthusiast

Filter on two separate date field ranges using between function

Need help with Where clause to filter on two separate date fields.  Both have the same date ranges.  Please see the code below. 

Where

C.pmt_last_upd_dt between '2013-07-01' and current_date and B.b_a_added_date between '2013-07-01'and current_date

) with data primary index (customer_id, sndr_id, b_a_customer_id, ach_nf_txn_amt_sum, ach_nf_txn_cnt, b_a_added_date, pmt_last_upd_dt, ach_country, trans_amt_usd);

4 REPLIES
Enthusiast

Re: Filter on two separate date field ranges using between function

Hi,

What is th e issue you are facing in using condition?

Khurram
Enthusiast

Re: Filter on two separate date field ranges using between function

I need to match the dates between the two fields for each record.  Do you need to see the complete SQL statement?

Enthusiast

Re: Filter on two separate date field ranges using between function

You can use the following SQL

Where 
C.pmt_last_upd_dt = B.b_a_added_date AND
(C.pmt_last_upd_dt between '2013-07-01' AND current_date
AND B.b_a_added_date between '2013-07-01'AND current_date)

This is what you want? Else please add more description of your scenario.

Khurram
Enthusiast

Re: Filter on two separate date field ranges using between function

Yes, this is what I needed.  Thanks for your help!