Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: Maximum Function Post Reply Post New Topic
Author Message
dczysz
Newbie
Newbie


Joined: 20 Oct 2010
Location: United States
Online Status: Offline
Posts: 1
Quote dczysz Replybullet Topic: Maximum Function
     Posted: 20 Oct 2010 at 5:51am

I have an address table with an address_key (1, 2, 3, ect.) where the highest address key is the current address.  I'm trying to pull the record with the highest address key in the selection criteria.  I attempt to use the MAXIMUM function, but I keep getting the error message "A Boolen is required here."  The Address Key field is a number field.  Why do I get this message and is there another way that works to pull the record with the highest address key?

IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4374
Quote lockwelle Replybullet Posted: 21 Oct 2010 at 3:20am
I am assuming, from the error, that there is a statement like:
Where address_key = max(address_key)...
 
if so, SQL won't process it, aggregates are not allowed in the where clause, and CR is probably raising the wrong error.
 
what you can do is something like:
select * from table where address_key in (select max(address_key) from table)
 
HTH
IP IP Logged
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum