Forum Replies Created

Viewing 7 posts - 1 through 7 (of 7 total)

  • RE: Aggregating monthly sales data by column

    select SUM(OrderQty) 'Quantity', convert(varchar,month(OrderDate))+'-'+convert(varchar,YEAR(OrderDate)) as 'Month year'

    from table1

    group by MONTH(OrderDate),YEAR(OrderDate)

    having year(OrderDate) between '2008' and '2011'

  • RE: How well do you know MAX?

    good twister

    To get third highest salary

    select MAX(salary) from Employees where salary <(select MAX(salary) from Employees

    where salary <(select MAX(salary) from Employees))

  • RE: Please Help

    change table name as what you have given i have used testtable

  • RE: Please Help

    select distinct a.district,c.male as male,b.female as female from testtable a

    left join

    (select district,count(gender) as female from testtable

    group by district,gender

    having gender='female'

    )b

    on b.district=a.district

    left join

    (select district,count(gender) as male from testtable

    group by district,gender

    having...

  • RE: Please Help

    select distinct a.district,c.male as male,b.female as female from testtable a

    left join

    (select district,count(gender) as female from testtablec

    group by district,gender

    having gender='female'

    )b

    on b.district=a.district

    left join

    (select district,count(gender) as male from testtablec

    group by district,gender

    having...

  • RE: Best Way to Calculate Age

    Third option calucates wrong age

Viewing 7 posts - 1 through 7 (of 7 total)