| List: | General Discussion | « Previous MessageNext Message » | |
| From: | nigel wood | Date: | April 30 2009 1:49pm |
| Subject: | Re: Totalling Counts done in Subqueries | ||
| View as plain text | |||
Peter Brawley wrote: > > Is there a way to total counts done in subqueries? > > Select expression aliases can't be referenced at the same level. You > have to create another outer level ... > alternatively use variables: mysql> select @first := 1 as value1, @second := 2 as value2, @first+@second as total; +--------+--------+-------+ | value1 | value2 | total | +--------+--------+-------+ | 1 | 2 | 3 | +--------+--------+-------+ 1 row in set (0.03 sec)
