need data between selected dates

Database

need data between selected dates

HI

Below is the query its working fine but when i added between dates i started creating problem.There is a mistake in selecting between days.Please help me out this.

SELECT AL2.Pod_Id, AL2.Internet_Pod_Id, AL2.Sku_Id FROM
EDW_VIEWS.PRES_OFR_STAT_HIST AL1 LEFT OUTER JOIN EDW_VIEWS.PRES_OFR_MEDIA_SET_SKU AL2 ON (AL1.Pod_Id=AL2.Pod_Id )
WHERE AL1.Pres_Ofr_Stat_Strt_Dt >={d'2007-10-30'} Between AL1.Pres_Ofr_Stat_End_Dt <={d'2007-11-30'} AND AL1.Pres_Ofr_Stat_Cd='A'
AND NOT EXISTS (
SELECT * FROM EDW_VIEWS.TRANSACTIONS AL3 WHERE AL3.SOLD_SKU_ID = AL2.SKU_ID
AND AL3.SALES_TRANSACTION_CHANNEL_CD=1 AND AL3.DELIVERY_METHOD_ID=3 )
order by AL1.POD_ID,AL2.SKU_ID
2 REPLIES

Re: need data between selected dates

Could you post the error that you are getting? Are you passing those dates as parameters?

Re: need data between selected dates

Below is a way to use the between..and. You would need a single date expression to check between..and range:

WHERE AL1.Pres_Ofr_Stat_Strt_Dt Between d'2007-10-30' and d'2007-11-30' AND AL1.Pres_Ofr_Stat_Cd='A'