Thanks. Duh. I knew it had to be easier than I was making it.

I got it working with an inner join on a subquery, but did not think
it was the easiest solution.

Thanks,
Jerry Johnson

On 7/18/05, James Holmes <[EMAIL PROTECTED]> wrote:
> I think this would work in Oracle at least and probably in a lot of
> other DMBS (probably not MySQL) - note this is untested.
> 
> SELECT *
> FROM MyTable T
> WHERE SEQUENCENUMBER = (
>   Select MAX (SEQUENCENUMBER)
>   FROM MyTable
>   WHERE ITEMID = T.ITEMID
>    )
> 
> On 7/18/05, Jerry Johnson <[EMAIL PROTECTED]> wrote:
> > Can someone point me to a tutorial/manual that will help me get the
> > following? I've done it before, but cannot for the life of me remember
> > the _right_ way to do this in one query.
> >
> >  table has recID (unique), itemID (not unique) and sequence number.
> >
> > How do I write a select to only return records with the max sequence
> > number for each itemID?
> 
> 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Find out how CFTicket can increase your company's customer support 
efficiency by 100%
http://www.houseoffusion.com/banners/view.cfm?bannerid=49

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:212116
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to