Home Forums SQL Server 2005 SQL Server Newbies query to find average age and percentage of patients with something RE: query to find average age and percentage of patients with something

  • prb88 (5/9/2013)


    ive added the group by but it results to this

    no of operations

    1

    2

    5

    7

    when i need it to result like this:

    Consultant name No. of operations

    Dr Smith 3

    Dr Bloggs 5

    Dr Doe 20

    Just a guess:

    select

    COUNT(operation) as [number of operations]

    ,Consultant

    from

    tablename

    where (Consultant = 'Dr Bloggs' or Consultant = 'Dr Smith' or Consultant = 'Dr Doe')

    group by

    Consultant

    ==========================================================================================================================
    A computer lets you make more mistakes faster than any invention in human history - with the possible exceptions of handguns and tequila. Mitch Ratcliffe