I have some silly sql difficulties and I just don't get it...
The query looks like this:
The output just won't show any result for the two subselects. The subselects don't get the "where user_id = gc.user_id and comment_type = gc.comment_type" right...
Any suggestions?
Is there a way to make this query a little more efficient, as I have to select the same stuff twice inside the two subqueries.
Thanks
The query looks like this:
select count(gc.comment_id), gc.comment_type
(select avg(wert) from general_bewertung where comment_id in
(select comment_id from general_comments where user_id = gc.user_id
and comment_type = gc.comment_type))
as
durchschnitt_bewertung,
(select count(gelesen_id) from general_gelesen where
on_what_id in (select comment_id from general_comments where user_id =
gc.user_id and comment_type = gc.comment_type)) as x_gelesen
from general_comments gc
where gc.user_id = $user_id
group by gc.comment_type
The output just won't show any result for the two subselects. The subselects don't get the "where user_id = gc.user_id and comment_type = gc.comment_type" right...
Any suggestions?
Is there a way to make this query a little more efficient, as I have to select the same stuff twice inside the two subqueries.
Thanks
Request notifications