Ask a Question related to Dreamweaver AppDev, Design and Development.

  1. #1

    Default Top sellers SQL ?

    Hi - using asp/access/vbscritp

    Have a webshop where all orders are stored in a cart table in the database.
    Need an advice on how to get an SQL that filter the 5 most sold products (The
    ProductID that has been repeated most times 1-5) in the cart table, and then
    make an output list of product 1 to 5 like this:

    Most sold:
    1. Productname01
    2. Productname26
    3. Productname55
    4. Productname65
    5. Productname100

    Any suggestions?

    Bjorn.

    btn Guest

  2. Similar Questions and Discussions

    1. Hosting - Today's best sellers with discounts
      Looking for a good hosting provider? The following site lists today's best selling hosting providers for shared and dedicated hosting....
    2. many-to-many query -- buyers and sellers
      Hi, I'm trying to do something that seems very simple, but has me stumped. The real application I'm working on is quite complex, so I'll just use...
    3. New Website: www.bquote.com Sellers compete > Buyers get the best price!
      We worked very hard to make a website called http://www.bquote.com, and we went live on September 19, 2003 so if you would take a look at it we...
    4. O.T. digital camera sellers
      I hate to start another thread on this subject but I need some advice. I cannot find the camera I am seeking at B & H Photo ;( Has anyone ever dealt...
  3. #2

    Default Re: Top sellers SQL ?

    with something like this:

    SELECT TOP 5
    OrderDetails.ProductID,
    SUM(OrderDetails.Quantity) as TotalNum,
    Products.ProductName

    FROM
    OrderDetails
    INNER JOIN Products ON OrderDetails.ProductID = Products.ProductID

    GROUP BY
    OrderDetails.ProductID,
    Products.ProductName

    ORDER BY
    TotalNum DESC





    --

    JScavitto
    Home of the UltraCart Shopping Carts
    [url]www.ottivacsdesign.com[/url]
    [url]www.thechocolatestore.com[/url]


    "btn" <webforumsuser@macromedia.com> wrote in message
    news:d74vta$92m$1@forums.macromedia.com...
    > Hi - using asp/access/vbscritp
    >
    > Have a webshop where all orders are stored in a cart table in the
    > database.
    > Need an advice on how to get an SQL that filter the 5 most sold products
    > (The
    > ProductID that has been repeated most times 1-5) in the cart table, and
    > then
    > make an output list of product 1 to 5 like this:
    >
    > Most sold:
    > 1. Productname01
    > 2. Productname26
    > 3. Productname55
    > 4. Productname65
    > 5. Productname100
    >
    > Any suggestions?
    >
    > Bjorn.
    >

    JScavitto Guest

  4. #3

    Default Re: Top sellers SQL ?

    Write a query in the database to count the various times that the
    ProductName appears and set it to output in desc order. The use this query
    as you source for your SQL statement on the webpage but add the "Top 5" to
    limit the display like this

    Select Top 5 ProductName ProductCount
    From qryTopProd
    Order by ProductCount Desc

    --
    Regards

    Paul Whitham
    Macromedia Certified Professional for Dreamweaver MX2004
    Valleybiz Internet Design
    [url]www.valleybiz.net[/url]

    Team Macromedia Volunteer for Ultradev/Dreamweaver MX
    [url]www.macromedia.com/support/forums/team_macromedia[/url]

    "btn" <webforumsuser@macromedia.com> wrote in message
    news:d74vta$92m$1@forums.macromedia.com...
    > Hi - using asp/access/vbscritp
    >
    > Have a webshop where all orders are stored in a cart table in the
    database.
    > Need an advice on how to get an SQL that filter the 5 most sold products
    (The
    > ProductID that has been repeated most times 1-5) in the cart table, and
    then
    > make an output list of product 1 to 5 like this:
    >
    > Most sold:
    > 1. Productname01
    > 2. Productname26
    > 3. Productname55
    > 4. Productname65
    > 5. Productname100
    >
    > Any suggestions?
    >
    > Bjorn.
    >

    Paul Whitham TMM Guest

Posting Permissions

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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139