sql statement need help

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • ilaboo

    #1

    sql statement need help


    i have a table with fields

    date
    company
    item




    what i want to do
    in steps


    problem is find out the number of times we order from the companies we
    order from sorted by least order from to most--i recognize that the
    count(item) might not be the actual field returned--i will modify the
    select statement once i know what count(item) returns.

    count the items and group by company

    select * from my_data count(item) group by company:


    now i want to inhance this query

    i want to sum the count

    something like this i think


    select * from my_data count( sum (item)) group by company;------is this
    right?

    then to inhance furter do something that gives me counts by year

    select * from my_data count(sum(item) ) group by year,company order by
    count(sum(item) );



    or is this right


    select * from my_data count(item),sum (count(item) group by year, company;


    any help is appreciated

    tia
    peter




Working...