Between Dates in Visual Fox Pro 2.6

I need to do a query from a range of dates, is there any way to do this is the query I'm using:

SELECT        cuoprevi.CODSOC, cuoprevi.CONTRATO, cuoprevi.NCUOTA, cuoprevi.CUFECHA, cuoprevi.CUFONDO, pagoprev.PATOTAL, cuoprevi.CUFLAG
FROM            cuoprevi, geprevis, pagoprev
WHERE        cuoprevi.CONTRATO = geprevis.CONTRATO AND pagoprev.CONTRATO = cuoprevi.CONTRATO
 AND (cuoprevi.CUFECHA BETWEEN geprevis.F_CONTRATO AND   NOW())
GROUP BY 1, 2, 3


the error is in between
ORDER BY cuoprevi.CUFECHA


infogwsAsked:
Who is Participating?
 
jrbbldrCommented:
If you look into your VFP Help file for the BETWEEN() function you will see how to use it properly.

BETWEEN(dCheckDate, dFirstDate, dLastDate)

Good Luck
0
 
Missus Miss_SellaneusCommented:
What is the error?

Use "DATE()" instead of "NOW()".
0
 
infogwsAuthor Commented:
I am running the query from a dataset in visual studio, I'm try this query
SELECT cuoprevi.CODSOC, cuoprevi.CONTRATO, cuoprevi.NCUOTA, cuoprevi.CUFECHA, cuoprevi.CUFONDO, pagoprev.PATOTAL, cuoprevi.CUFLAG
FROM cuoprevi, geprevis, pagoprev
WHERE (cuoprevi.CONTRATO = geprevis.CONTRATO) AND (pagoprev.CONTRATO = cuoprevi.CONTRATO) AND BETWEEN (cuoprevi.CUFECHA, geprevis.f_contrato, date ())
GROUP BY 1, 2, 3
BY ORDER cuoprevi.CUFECHA

the error says: unable to parse the query text
0
 
pcelbaCommented:
1) Visual Fox Pro 2.6 does not exist
2) "BY ORDER" should be reported as error
3) What is the reason for GROUP BY in the query? You are groupping by 3 columns but you don't use any aggregate function in the query which is not correct.
4) Post the code you are using in Visual Studio incl. connection string. It will tell much more and allow to help better.


Note to jrbbldr
 x BETWEEN y AND z   is allowed in FoxPro
0
 
infogwsAuthor Commented:
found then solution elsewhere. thanks!
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.