470,591 Members | 2,174 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,591 developers. It's quick & easy.

Sub-query workeround for v 3.23! please help

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.

Mar 11 '06 #1
1 1224
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.

Mar 11 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

5 posts views Thread by John Dewbert | last post: by
3 posts views Thread by Kathy Burke | last post: by
6 posts views Thread by Greg Strong | last post: by
6 posts views Thread by Thom Little | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.