After run the following query i got the output as,
select st.visittime,op.datepurchased from alamyStatistics..st_emailTracking st
join alamyusers..up_visitor up on st.userid=up.userid
join alamyorders..op_order op on op.userid=st.userid
where st.userid='F5C2B992-E755-4B2C-AC80-003C0B825CDA' and op.datepurchased between st.visittime and dateadd(dd,30,st.visittime) and st.emailcode like '_%NB'
and up.isdistrib=0 and op.orderstatusid = 100 and op.order_total!=0 and op.orderstatusid = 100 and op.datepurchased between '09-22-08' and '02-18-09'
is only for a particular user. But what I need is , u can see this particular user has different Visittime , but same purchased date. So i wish my output should be like Visittime Datepurchased
2009-01-15 14:37:24.000 2009-01-15 15:30:44.163
That means if a user has different visittimes with same purchased date, take the minimum visittime along with purchased date.
Can anyone help?
Are u clear my qn, otherwise just ask me i am happy to discuss more.
Disclaimer: Advice is provided to the best of my knowledge but no implicit or explicit warranties are provided. Since the advisor explicitly encourages testing any and all suggestions on a test non-production environment advisor should not held liable or responsible for any actions taken based on the given advice.