List:General Discussion« Previous MessageNext Message »
From:walter harms Date:July 25 2008 3:24pm
Subject:Re: How do I (can I) use aggregate functions inside a select
View as plain text  

David Ruggles wrote:
> I may be approaching this all wrong, but I need to know a percentage of
> total sales within a select statement.
> 
> So I can do something like this:
> Select company, state, sales, sum(sales) / sales as percent
> From Sales
> 
> 

  mmh, you want

  sum(sales where company="foo")/sum(sales)

  you can do this only when doing 2 queries and storing al least one result	

  re,
    wh


Thread
How do I (can I) use aggregate functions inside a selectDavid Ruggles25 Jul
  • Re: How do I (can I) use aggregate functions inside a selectAnanda Kumar25 Jul
    • RE: How do I (can I) use aggregate functions inside a selectDavid Ruggles25 Jul
      • RE: How do I (can I) use aggregate functions inside a selectIan Simpson25 Jul
      • RE: How do I (can I) use aggregate functions inside a selectJerry Schwartz25 Jul
  • Re: How do I (can I) use aggregate functions inside a selectwalter harms25 Jul