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.ActiveConne ction = 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
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.ActiveConne
Recordset1_cmd.CommandText
Recordset1_cmd.Prepared = true
Set Recordset1 = Recordset1_cmd.Execute
Recordset1_numRows = 0
%>
regards
kenny
SELECT buis_dis, date_payment FROM topofhead.cs_buis_opport where date_payment >= DATE_SUB(date_payment,INTE RVAL 7 type)
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,INTE RVAL 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
ok I have given this a rattle
buis_date >= DATE_SUB(date_payment,INTE
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]
regards
k
ASKER
hello again this my complete q
SELECT cs_buis_opportunity.buis_d ate FROM cs_buis_opportunity WHERE buis_date >= DATE_SUB(buis_date,INTERVA L 7 type)
and it doesnt work
am grateful for any help
k
SELECT cs_buis_opportunity.buis_d
and it doesnt work
am grateful for any help
k
ASKER CERTIFIED SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
ASKER
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
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
ASKER
hi yea thatGhost,
come ere thanks for your help
AND DATE_SUB(CURDATE(),INTERVA L 7 DAY) <= buis_date
the above works,
have a great weekend
k
come ere thanks for your help
AND DATE_SUB(CURDATE(),INTERVA
the above works,
have a great weekend
k