Daniel,
> select triv_a_r.login as user, count(triv_a_r.login) as score,
> sum(triv_a_r.tm)/1000 as time
> from triv_a_r LEFT OUTER JOIN triv_q_r ON (triv_a_r.tq_id =
> triv_q_r.id)
> where triv_a_r.ans = triv_q_r.ans
> group by triv_a_r.login
> order by score desc, time asc;
A little SQL trick:
hi-
i have two tables which are used to track questions and answers in a
trivia game. the structure of the tables is as follows:
CREATE TABLE triv_q_r (
id VARCHAR(10) CONSTRAINT triv_q_r_pkey PRIMARY KEY,
t_idVARCHAR(10) CONSTRAINT triv_q_r_t_id_fkey N