Re: Distinct problem

2006-07-18 Thread Gerald L. Clark
Tanner Postert wrote: I actually solved my own problem... SELECT t1.item_id, t1.dt, t1.text ,t3.* FROM table AS t1, table3 as t3 LEFT JOIN table AS t2 ON t1.item_id = t2.item_id AND t1.dt < t2.dt WHERE t2.item_id IS NULL; becomes SELECT t1.item_id, t1.dt, t1.text FROM (table AS t1, table3 as t

Re: Distinct problem

2006-07-18 Thread Tanner Postert
I actually solved my own problem... SELECT t1.item_id, t1.dt, t1.text ,t3.* FROM table AS t1, table3 as t3 LEFT JOIN table AS t2 ON t1.item_id = t2.item_id AND t1.dt < t2.dt WHERE t2.item_id IS NULL; becomes SELECT t1.item_id, t1.dt, t1.text FROM (table AS t1, table3 as t3) LEFT JOIN table AS t

Re: Distinct problem

2006-07-18 Thread Tanner Postert
the below query worked great in mysql 3.23, but we just moved to 5.0 and it broke, i can see that the join rules changed in 5.0, but i can't get the right syntax to make this query work. any help would be appreciated. On 6/28/06, Peter Brawley <[EMAIL PROTECTED]> wrote: Tanner >I am trying t

Re: Distinct problem

2006-06-28 Thread Peter Brawley
Tanner >I am trying to group my results by the last activity on each row, my query >looks like this >select text, dt, item_id from table >where >group by item_id >order by dt DESC SELECT t1.item_id, t1.dt, t1.text FROM table AS t1 LEFT JOIN table AS t2 ON t1.item_id = t2.item_id AN

Re: Distinct problem

2006-06-28 Thread Dan Buettner
Use the MAX() function, like so: select text, MAX(dt) as dt, item_id from table where group by item_id order by dt DESC Dan On 6/28/06, Tanner Postert <[EMAIL PROTECTED]> wrote: The situation is somewhat hard to describe, so please bare with me: I am trying to group my results by the la

Re: DISTINCT problem

2001-07-29 Thread Graham Nichols
Already done my friend - works like a dream. best, Graham -Original Message- From: Jeremy Zawodny <[EMAIL PROTECTED]> To: Graham Nichols <[EMAIL PROTECTED]> Cc: [EMAIL PROTECTED] <[EMAIL PROTECTED]> Date: 29 July 2001 10:39 Subject: Re: DISTINCT problem >On Th

Re: DISTINCT problem

2001-07-29 Thread Jeremy Zawodny
On Thu, Jul 26, 2001 at 09:31:29PM +0100, Graham Nichols wrote: > > Distinct can only be used with count > > count(distinct field_name) --- OK for 3.23 NOT for 3.22 > > from MYSQL version 3.23. I have only version 3.22. How can I get > around this please? Upgrade? :-) -- Jeremy D. Zawo