All Forums Database
harsha reddy 5 posts Joined 02/08
08 Feb 2008
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_IDAND AL3.SALES_TRANSACTION_CHANNEL_CD=1 AND AL3.DELIVERY_METHOD_ID=3 )order by AL1.POD_ID,AL2.SKU_ID

Someshnr 53 posts Joined 06/07
11 Feb 2008

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

nithyanandam 65 posts Joined 10/04
11 Feb 2008

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'

You must sign in to leave a comment.