infogws
asked on
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
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
ASKER CERTIFIED SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
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
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
ASKER
found then solution elsewhere. thanks!
ASKER
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