• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

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

Guest
Jul 19, 2013 Jul 19, 2013

Copy link to clipboard

Copied

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?

Views

443

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Jul 19, 2013 Jul 19, 2013

Copy link to clipboard

Copied

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Jul 22, 2013 Jul 22, 2013

Copy link to clipboard

Copied

LATEST

Thank you.

I was trying to make this too complicated.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Documentation