> Hello i have 2 tables.  Table X has EMAIL and DATE
> and table Y has EMAIL, DATE, and SALES.   i want to
> pull all sales for the previous year from Y for
> emails based on a day before their DATE in X.  so the
> date range in Y will be constantly changing by EMAIL
> based on X.DATE.  I need to use sql code to access
> the server.
> 
> so the date part of the query would be 
> y.date between x.date-366 and x.date-1
> 
> can somebody tell me how to do this?
> 
> can somebody tell me how to do this?
I'm sure "someone" can, but ...
 
since you want to run sql on the server, it might help to :
1
consider which server or server-type will run your code
2
consider telling us what server 
3
consider using a forum that deals with that database server
 
good as poster/answerers on this forum generally are, mind reading is normally not available