Aggregate Function Help (first and last records)

2006-08-04 Thread Michael Caplan
Hi there, I am trying to figure out how to flatten the result set of a join query using aggregate functions. For several fields (b.refering_url, c.string, b.first_page, b.last_page) I need to pull out the _first_ or _last_ item as ordered from the records returned from the join. However,

Re: Aggregate Function Help (first and last records)

2006-08-04 Thread Michael Caplan
I just noticed that MSAccess and SQL server support FIRST() and LAST() functions. Is there an equivalent in MySQL? My research has come up with nil so far. Thanks, Michael Michael Caplan wrote: Hi there, I am trying to figure out how to flatten the result set of a join query using

Re: Aggregate Function Help (first and last records)

2006-08-04 Thread Michael Caplan
Thanks Nestor, I thought about that, but limit 1 doesn't work in my scenario as I want to access both the FIRST() and LAST() column for a result set simultaneously. By telling MySQL to limit to 1, I could get the first, but not the last. I want mysql to give me the first, drop everything in

Re: Aggregate Function Help (first and last records)

2006-08-04 Thread Michael Caplan
Thanks Nestor! I think I am almost there. However, how can I limit the result of a JOIN in a query, and not the entire result set? For example: SELECT * FROM a JOIN b ON a.id = b.id If I wanted all records from a and only the first record from b, how would I integrate a LIMIT