AV1611 Posted June 15, 2006 Share Posted June 15, 2006 //edit figured it out, but will leave up if anyone cares:// this was the problem line:// AND DATE_SUB(NOW(),INTERVAL 30 DAY)<=surveyresults.DATE");//forgot the surveyresults. part neither of these will work...[code]$result1 = mysql_query("Selectcount( distinct surveyresults.ID)FromsurveyresultsInner Join survey ON surveyresults.ID = survey.IDWheresurvey.INACTIVE Not Like 'YES'AND DATE_SUB(NOW(),INTERVAL 30 DAY)<=DATE");if ($row = mysql_fetch_array($result1)){$result2 = mysql_query("Selectsurveyresults.TEAM_LEADER,surveyresults.FNAME,surveyresults.LNAME,surveyresults.ID,Avg(surveyresults.RATING) AS RATINGFromsurveyresultsInner Join survey ON surveyresults.ID = survey.IDWheresurvey.INACTIVE Not Like 'YES'AND DATE_SUB(NOW(),INTERVAL 30 DAY)<=DATEGroup Bysurveyresults.IDORDER BYRATING desc");[/code]here is my table structure:# Table "surveyresults" DDLCREATE TABLE `surveyresults` ( `TEAM_LEADER` varchar(255) NOT NULL default '', `FNAME` varchar(255) NOT NULL default '', `LNAME` varchar(255) NOT NULL default '', `ID` varchar(255) NOT NULL default '', `RATING` varchar(255) NOT NULL default '', `EVALUATOR` varchar(255) NOT NULL default '', `DATE` date NOT NULL default '0000-00-00', `IP` varchar(255) NOT NULL default '', `HOSTNAME` varchar(255) NOT NULL default '', `REMARKS` text NOT NULL) ENGINE=InnoDB DEFAULT CHARSET=latin1 COMMENT='InnoDB free: 13312 kB; InnoDB free: 13312 kB; InnoDB free: 1' Link to comment https://forums.phpfreaks.com/topic/12083-date_sub/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.