Re: ORDER BY Help

2008-10-24 Thread Tompkins Neil
Hi Basically from the query below, it would only return one product like RedLight. But I need to return a list of all products, ordered by a SELECT ProductID, ProductName, AVG(ProductScore * Quantity) AS a FROM Products GROUP BY ProductID ORDER BY a DESC On Fri, Oct 24, 2008 at 2:53 PM, Ol

Re: ORDER BY Help

2008-10-24 Thread Olexandr Melnyk
Still doesn't make much sense to me. Could you show us how to calculate it for some of the rows above? 2008/10/24, Tompkins Neil <[EMAIL PROTECTED]>: > > Hi > > Thanks for your quick reply. The sample value for "a" would be like a > average of integer. e.g 6.01, or 10.19. > > Neil > > On Fri, Oct

Re: ORDER BY Help

2008-10-24 Thread Tompkins Neil
Hi Thanks for your quick reply. The sample value for "a" would be like a average of integer. e.g 6.01, or 10.19. Neil On Fri, Oct 24, 2008 at 2:49 PM, Olexandr Melnyk <[EMAIL PROTECTED]> wrote: > Could give us sample values for "a" field? Should it contain the same thing > as in the query I've

Re: ORDER BY Help

2008-10-24 Thread Olexandr Melnyk
Could give us sample values for "a" field? Should it contain the same thing as in the query I've sent? 2008/10/24, Tompkins Neil <[EMAIL PROTECTED]>: > > Hi > > This works, however I still want to be able to list the whole list like > because I need to display it on the screen, but in the ordered

Re: ORDER BY Help

2008-10-24 Thread Tompkins Neil
Hi This works, however I still want to be able to list the whole list like because I need to display it on the screen, but in the ordered together i.e all RedLights, all BlueLights etc a Date ProductID ProductName ProductScore Quantity %2008-11-

Re: ORDER BY Help

2008-10-24 Thread Olexandr Melnyk
SELECT ProductID, ProductName, AVG(ProductScore * Quantity) AS a FROM Products GROUP BY ProductID ORDER BY a DESC 2008/10/24, Tompkins Neil <[EMAIL PROTECTED]>: > > Following on from my email below I now need help with the following > problem. Here is a list of my sample data > > Date

Re: ORDER BY Help

2008-10-24 Thread Tompkins Neil
Following on from my email below I now need help with the following problem. Here is a list of my sample data Date ProductID ProductNameProductScore Quantity 2008-11-10100 Red Light 0.05 10 2008-11-11100

Re: ORDER BY Help

2008-10-24 Thread Olexandr Melnyk
SELECT ProductName FROM Products WHERE ProductScore > 100 ORDER BY CASE WHEN ProductScore = 125 THEN 0 ELSE 1 END, ProductScore But this query won't use an index, so it would be a good idea to do this in two queries 2008/10/24 Tompkins Neil <[EMAIL PROTECTED]> > Hi > > I've the following

ORDER BY Help

2008-10-24 Thread Tompkins Neil
Hi I've the following basic query like SELECT ProductName FROM Products WHERE ProductScore > 100 ORDER BY ProductScore However, how can I order by ProductScore, but ensure the product with ID 125 is at the top ? Is this possible. Thanks Neil