Do you have a question? Post it now! No Registration Necessary. Now with pictures!
- Posted on
- merging two querys
October 24, 2006, 7:09 am
rate this thread
I have two query that I I would like to be one, but I can't figure out
how to do it. (mysql 3.23)
$sql = sprintf ("SELECT task,SUM(hours),login FROM activities WHERE
login='%s' group by login",$usuario);
$sql2 = sprintf ("SELECT SUM(hours) FROM activities WHERE login='%s'
AND month='%s' group by login",$usuario,$getdate);
Thank you for any help.
Re: merging two querys
Or, failing that:
SELECT @prev_login := NULL ;
SELECT login, SUM( hours ) AS time, MAX( @task :=
@prev_login = login, CONCAT_WS( ',', @task , task ) , task )
) AS task
WHERE login = '%s'
AND date = '%s'
GROUP BY login
LIMIT 0 , 30
- » Americanas.com SALDO de TVs Com at 80% de Desconto (29798)
- — Newest thread in » MySQL Database Forum