Re: Trying to query top selling products

2006-08-24 Thread Will Tomlinson
>It just means the second field in the select statement. > >MJS Oh cool. I've never seen that done before. New trick in the toolbox. :) Thanks Will ~| Introducing the Fusion Authority Quarterly Update. 80 pages of hard-hitting,

Re: Trying to query top selling products

2006-08-23 Thread Mary Jo Sminkey
> I changed it to top 5 and added a little more pizazz. My quesion is, > why is the order by like that? What is 2? I've only seen it done by > field names. It just means the second field in the select statement. MJS ~| Intro

Re: Trying to query top selling products

2006-08-23 Thread Will Tomlinson
>Here's some SQL for MS SQL Server (you're not using Access are you?): Dude, works like a champ! You rock! I changed it to top 5 and added a little more pizazz. My quesion is, why is the order by like that? What is 2? I've only seen it done by field names. SELECT TOP 5 prodName + ' ' + merch

Re: Trying to query top selling products

2006-08-23 Thread Jeff Guillaume
Here's some SQL for MS SQL Server (you're not using Access are you?): select top 10 prodName, sum(prodQty) as totalOrdered from tblOrderItems group by prodName order by 2 desc ~| Introducing the Fusion Authority Quarterly Update.

Trying to query top selling products

2006-08-23 Thread Will Tomlinson
I'm workin on a query to retrieve top selling items. This is SQL Server. Here's the pertinent table. tblOrderItems --- OrderItemID prodname prodqty What's messin with me is it looks like I need to multiply a COUNT by prodqty. Here's the SQL I've setup so far. Yes, it's almost t