Skip navigation
Currently Being Moderated

How can I grab the min pic and max pic by the date entered?

Jul 19, 2013 5:39 AM

I have a script that loads two pics at once and saves them as individual files. What I am trying to do is grab them individually using min(), max() where date_entered. But, I get the error "You tried to execute a query that does not include the specified expression 'date_entered' as part of an aggregate function." HEre is my code"

 

 

<cfquery name="getSire" datasource="#application.database#">

select date_entered, max(pic) as topPic from litters

where date_entered = '7/19/2013'

</cfquery>

 

How can I select the min picture and the max picture by the date it was entered?

 
Replies
  • Currently Being Moderated
    Jul 19, 2013 7:16 AM   in reply to rickaclark54

    You need "GROUP BY date_entered" after WHERE clause.

     

    select date_entered, max(pic) as topPic from litters

    where date_entered = '7/19/2013'

    group by date_entered

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points