Does anyone know a way to gain the same advantages as a subquery (mysql 4.1)? I have 4.0 which doesn't support subqueries. If I could subquery, my problem would be fixed easily.
Basically, I am trying to combine two tables that have the same fields and run a query from that combined format. Here is the basic statement:
SELECT
ROUND( AVG( ( a.rank + a.ballots ) *
( ( LOG10(b.powerrank) / 3 ) )) + ( COUNT(a.name) * 3 ), 3 ) as total,
COUNT(a.name) as num,
a.name,
a.school,
a.tourny,
a.side,
a.team,
b.id
FROM ranks_atty a, ranks_tourny b
WHERE a.tourny=b.id
GROUP BY a.name
ORDER BY total DESC LIMIT 30
I have two tables: ranks_witness and rank_atty. The structure of both tables is identical:
name | school | tourny | rank | side | team | ballots
i need to first combine those two tables into one table then that table would fit into the above query instead of the "rank_atty" table. i dont know if i'm being clear, but that's the basic idea. Any ideas how I can do that?