Sub-query workeround for v 3.23! please help

Sub-query workeround for v 3.23! please help

am 11.03.2006 15:47:13 von alex9913

Hello, i've writen a query for a known "how to make order by before
group by" issue:

SELECT t1.* FROM t1INNER JOIN (SELECT serialid ,MAX(id) AS id FROM t1
GROUP BY serialid ) ids ON t1.id = ids.id WHERE game<10

it selects the latests id's from a table and groups by serialid to
eliminate multiple entries of same serialid

the tabe t1:
| id | serialid | game |
0 xuu3 11
1 xuu3 10
2 xuu3 13
3 ssa1 1

the problem is that i thought i would have the sub-queries support
(mysql above ver. 3.23) but my hosting provider proved me wrong. [and
there is no way to install higher version mysql]
so i'm pretty stuck with this one -

need a workaround that doesnt use the nested query as shown above but
still does the same work. Any help would be very appreciated.

Thanks,
Alex.

Re: Sub-query workeround for v 3.23! please help

am 11.03.2006 17:10:50 von alex9913

Thanks all,
I found a way to do this:

the one workaround suited for me the best is creating temporary table:

DROP TEMPORARY TABLE IF EXISTS xyz;
CREATE TEMPORARY TABLE xyz SELECT MAX(id) as ids FROM t1 GROUP BY
serialid;
SELECT t1.* FROM t1 INNER JOIN xyz ON t1.id = xyz.ids

Hope it would help someone someday.