Thanks Doug,

I solved the issue with this code:

        SELECT ID_ENC_TOY_IMAGE, ENC_TOY_IMAGE_LINK_TEXT
        FROM   ENC_TOY_IMAGE
        WHERE  ID_ENC_TOY_IMAGE = 
        (SELECT max(ID_ENC_TOY_IMAGE)
        FROM ENC_TOY_IMAGE
        WHERE ID_ENC_TOY = #ID_ENC_TOY#)

I was trying to grab the max id_enc_toy_image (last entered record) and the link text 
associated with it.

If I tried using the typical SELECT max (id_enc_toy_image) as whatever, 
enc_toy_image_link_text, I got a SQL aggregate error.  But anyway, the above solution 
worked great.

---mark


--------------------------------------------------------------
Mark Warrick
Phone: (714) 547-5386
Efax.com Fax: (801) 730-7289
Personal Email: [EMAIL PROTECTED]
Personal URL: http://www.warrick.net 
Business Email: [EMAIL PROTECTED]
Business URL: http://www.fusioneers.com
ICQ: 346566
--------------------------------------------------------------


> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
> Sent: Monday, September 25, 2000 1:42 PM
> To: CF-Talk
> Subject: RE: SQL Select Max + a column
> 
> 
> Mark,
> 
> How about explaining the need just a bit more.  I'm not clear about the
> max().  Are you trying to get the number and description of the 
> last item in
> the table or something else?
> 
> If you just want the description and ID of the last item in the database,
> the sub-select proposed by someone earlier would be the way to go.
> 
> This way it will find the max ID then do a select on the table for the ID
> (yes it's redundant but easy to reference) and text for just that ID.
> 
> --Doug
> 
> SELECT
>       ID_ENC_TOY_IMAGE,
>       ENC_TOY_IMAGE_LINK_TEXT
> FROM
>       ENC_TOY_IMAGE (NOLOCK)   ... if dirty reads are ok ...
> WHERE
>       ID_ENC_TOY = #ID_ENC_TOY#       AND
>       ID_ENC_TOY_IMAGE =
>               (
>               SELECT
>                       max (ID_ENC_TOY_IMAGE)
>               FROM ENC_TOY_IMAGE (NOLOCK)
>               )
> ------------------------------------------------------------------
> ------------
> Archives: http://www.mail-archive.com/[email protected]/
> To Unsubscribe visit 
> http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf
_talk or send a message to [EMAIL PROTECTED] with 'unsubscribe' in the 
body.

------------------------------------------------------------------------------
Archives: http://www.mail-archive.com/[email protected]/
To Unsubscribe visit 
http://www.houseoffusion.com/index.cfm?sidebarRsts&bodyRsts/cf_talk or send a message 
to [EMAIL PROTECTED] with 'unsubscribe' in the body.

Reply via email to