is it possible to use as a join condition the result of a function like COUNT?
for example:
Code:
select
a.key
from
a left join b on b.key = count(a.key)
group by
a.key;
or
Code:
select
count(a.key) as C
from
a left join b on b.key = C
group by
a.key;
is it even possible to reference a column from the select clause in the join conditional?
example:
Code:
select 5 as Five a left join b on b.key = Five;
what im trying to do: i have a table of rates per person in a room... which rate to use for a person depends on the total number of people in the room which i get by using count. im assuming i could accomplish this with subqueries.. but i dont have the latest version of mysql on my host.
thanks for any help!