Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Software > Access Queries > BETWEEN problem
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 5 Topic 41228 of 43104
Post > Topic >>

BETWEEN problem

by "salx" <u45336@[EMAIL PROTECTED] > Aug 7, 2008 at 06:06 PM

The below SQL returns unexpected results - SQL, table and result samples
provided

The objective: return rows from the master table when a transaction exist
for
the transaction date less 1 month


SELECT a.PKey, a.[SDate], a.[EDate], DateAdd('m',-1,b.TDate) AS TDless1
FROM tblMaster AS a
         , tblTran AS b
WHERE (A.PKey=B.PKey) 
     AND (DateAdd("M",-1,B.TDate) Between A.SDate and A.EDate);

tblMASTER
-----------------
PKey  SDate             EDate
00001 4/1/2008	5/1/2008
00001 5/1/2008	6/1/2008
00001 6/1/2008	6/1/2008
00001 7/1/2008	7/1/2008

tblTran 
----------
PKey  TDate
00001 6/1/2008


Results
----------
PKey  SDate             EDate
00001 5/1/2008	6/1/2008   **** not expected **** any ideas?
00001 6/1/2008	6/1/2008   **** expected and ok
 




 5 Posts in Topic:
BETWEEN problem
"salx" <u453  2008-08-07 18:06:18 
Re: BETWEEN problem
John Spencer <spencer@  2008-08-07 16:06:39 
Re: BETWEEN problem
=?Utf-8?B?S0FSTCBERVdFWQ=  2008-08-07 13:26:00 
Re: BETWEEN problem
"salx" <u453  2008-08-07 21:36:16 
Re: BETWEEN problem
"salx" <u453  2008-08-07 21:34:26 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Thu Nov 20 23:05:55 CST 2008.