Re: Totalling Counts done in Subqueries

2009-04-30 Thread Nigel Peck
Thanks Nigel and Peter, I went for Nigel's solution below. Both very useful, learnt a lot, thank you. Cheers, Nigel nigel wood wrote: > Is there a way to total counts done in subqueries? Never done this but my educated guess is: SELECT `Notes`.`note_id`, `Notes`.`last_updated_datetime`, `

Re: Totalling Counts done in Subqueries

2009-04-30 Thread nigel wood
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, @fir...@second as

Re: Totalling Counts done in Subqueries

2009-04-30 Thread Peter Brawley
> 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 ... SELECT note_id, last_updated_datetime,event_date,subject,summary,content, linked_issues_count,linked_people_count, linked_organis

Totalling Counts done in Subqueries

2009-04-30 Thread Nigel Peck
Hi all, I'm hoping someone can help me with this please. Is there a way to total counts done in subqueries? So I want to do: -=-=-=-=-=-=-= SELECT `Notes`.`note_id`, `Notes`.`last_updated_datetime`, `Notes`.`event_date`, `Notes`.`subject`, `Notes`.`summary`, `Notes`.`content`, (SELECT COUNT