> > SELECT max(stockid) as stockid, data1, data2 > > FROM table > > HAVING data1 = 5 > > > > Unfortunately this is returning the following data.... > > > > StockID | Data1 | Data2 > > ----------------------- > > 3 | 5 | 2 > > > > Ie: the correct stockid and data1 but data2 from a diferent row!
> The MySQL manual warns against that: > http://dev.mysql.com/doc/mysql/en/group-by-hidden-fields.html > > They also document how it should be done: > http://dev.mysql.com/doc/mysql/en/example-maximum-column-group > -row.html Yeah, this all started to get a bit complicated, so I dumped it. Worked arround it by selecting the ones I wanted in a new query, setting a flag in the db for those by looping over the new query, then modified the existing query to select based on that flag. Thanks anyway. -- Jay ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Discover CFTicket - The leading ColdFusion Help Desk and Trouble Ticket application http://www.houseoffusion.com/banners/view.cfm?bannerid=48 Message: http://www.houseoffusion.com/lists.cfm/link=i:4:211732 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

