Results 1 to 3 of 3

Thread: query problem

  1. #1
    Join Date
    Jan 2005
    Location
    Brooklyn
    Posts
    25

    Unanswered: query problem

    Hello,
    Im having difficulties to create correct query that has to return:

    SalesGroup (Alphabetical Order) ,
    ProductGroup (Alphabetical Order),
    FabricGroup
    Style
    Color
    Week TD Sale
    Month TD Sales ( Desc)
    YTD Sales

    But the trick part is for each SalesGroup, there are ProducGroups and each ProductGroup has different types of Fabric group, and each Fabric Group has Styles andColors.
    This query has to show each SalesGroup in alphabetical order, than ProductGroup in Alphabetical order, FabrickGroup (Grouped) for which the MonthTD sales is at the higher dollars.

    SalesGroup ProdGroup FabricGroup MTD Sales
    Active Adult Cotton 2,200
    Active Adult Cotton 1,000
    Active Adult Cotton 50
    Active Adult Supplex 2,400
    Active Adult Supplex 1,500
    Active Adult Supplex 200
    Active Adult Supplex 100
    Active Adult Twill 1,000
    Active Adult Twill 800
    Active Girls Cotton 2,000
    Active Girls Cotton 800
    Plus Adult Cotton 300
    Plus Adult Cotton 200
    Plus Legwr Supplex 1,200
    Plus legwr Supplex 600

    Appreciate all the help

  2. #2
    Join Date
    Aug 2005
    Location
    D/FW, Texas, USA
    Posts
    78
    Something like this should be pretty close...
    Code:
    Select SalesGroup, ProdGroup, FabricGroup, Sum(Sales)
    From myTable
    Group By SalesGroup, ProdGroup, FabricGroup
    Order By SalesGroup, ProdGroup, FabricGroup, Sum(Sales) Desc
    --wayne
    SELECT * FROM Users WHERE Clue>0
    0 rows returned

  3. #3
    Join Date
    Jan 2005
    Location
    Brooklyn
    Posts
    25
    The Sales data is already sum data, so there is no need to do a sum again.
    Thank you for this statement, but I did try it too

    Can I use the Union with diff SalesGroup in each statement.
    Will order by work in union?


    Thank you

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •