Link to home
Create AccountLog in
Avatar of thatelvis
thatelvis

asked on

mysql date filter by date less then 7 day old

Hello,
I have a recordset, I want to filter the table where the date is not older then 7 days after the date in column
date_payment  ,  can any one help me with this.


<%
Dim Recordset1
Dim Recordset1_cmd
Dim Recordset1_numRows

Set Recordset1_cmd = Server.CreateObject ("ADODB.Command")
Recordset1_cmd.ActiveConnection = MM_conloggy_STRING
Recordset1_cmd.CommandText = "SELECT buis_dis, date_payment FROM topofhead.cs_buis_opport"
Recordset1_cmd.Prepared = true

Set Recordset1 = Recordset1_cmd.Execute
Recordset1_numRows = 0
%>

regards

kenny
Avatar of theGhost_k8
theGhost_k8
Flag of India image

SELECT buis_dis, date_payment FROM topofhead.cs_buis_opport where date_payment >= DATE_SUB(date_payment,INTERVAL 7 type)
Avatar of thatelvis
thatelvis

ASKER

thankn you and sorry for the late reply I was nt able to get back to this.

ok I have given this a rattle

buis_date >= DATE_SUB(date_payment,INTERVAL 7 type)

and get this error, i am using a mysql database could this be the reason.

Microsoft OLE DB Provider for ODBC Drivers error '80040e14'

[MySQL][ODBC 3.51 Driver][mysqld-5.0.27-log]You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'type) ORDER BY buis_date DESC' at line 1


regards

k

hello again this my complete q


SELECT cs_buis_opportunity.buis_date FROM cs_buis_opportunity WHERE buis_date >= DATE_SUB(buis_date,INTERVAL 7 type)

and it doesnt work

am grateful for any help

k
ASKER CERTIFIED SOLUTION
Avatar of theGhost_k8
theGhost_k8
Flag of India image

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer
Hi yea,
And thanks again

I have used this

AND buis_date >= DATE_SUB(buis_date, INTERVAL 7 DAY) but it doesnt work, I have tried changing the date in my data base back 5,6,7,8 days etc to test it and no joy. I did a google around and can find anything i understand either.

if you can help i would be grateful

regards

k
hi  yea thatGhost,

come ere thanks for your help

AND  DATE_SUB(CURDATE(),INTERVAL 7 DAY) <= buis_date

the above works,

have a great weekend

k