|
dzirkelb1 -> Help with sql statement (4/12/2005 13:37:49)
|
I am having trouble on thinking of how to accomplish this...I'll try my best to explain. Basically, what happens is a shopper will call in to our office and ask for what we call "shop dates". What we do is ensure the individual store was shopped at least 7 days ago, if it was, then its clear to shop...if, however, it was shopped 3 days ago, then it isn't clear to shop and we tell them when it will be able to shop. So, now I'll list the applicable fields and describe them quick: PK ID- this is simply the autonumber - unique id...each shop has a specefic number. This increases and I think will be usable. Period/Month- This shows the frequency of shops we do a month for a specefic store. Example...if it says Apr, then we do a single shop in April. If it says Mar, then a single in March. If it says Apr 1st, then we do multiple shops a month...most commonly there will be an Apr 2nd for the same store in the same month, and sometimes an Apr 3rd and Apr 4th. RT1- This is what we call the route number...it is basically a numer we assign to a shopper for their current route. In its data is basically each store they need to do. So, shopper calls in for route 10864, and we then know what to look for. EvalDate- This is the date field for the shop...it shows what date it was shopped. KFC ID- the KFC store id TB ID- the Taco Bell store id So, what I'm sort of thinking about doing is like this: Subtract the current date from the most recent evaldate per Store ID and if it is greater than 7 days, then type clear or something...if it is less, then display the date it will be clear. All this is seperated by a simple where clause of rt1. I think I would need to pull all of the store id's out of the route, then pull the max eval date from those store id's, and subtract 7 days from that. Is this possible in one statement or would I have to create multiple? Currently this will be access based and will be implemented to the web in a couple weeks...so, I can do all the work in access for now (I can figure out the asp code after the sql is working) Any ideas on where to start? :)
|
|
|
|