User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the MS SQL section within the Web Development category of DaniWeb, a massive community of 373,939 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,648 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our MS SQL advertiser:
Views: 1352 | Replies: 3
Join Date: May 2008
Posts: 1
Reputation: tytyguy is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
tytyguy tytyguy is offline Offline
Newbie Poster

Sql Sort Query....

  #1  
May 4th, 2008
Ok, I have a e-commerce store that uses stored procedures to sort products. I have figured out how to sort my name and price but am having trouble sorting by rating bc the rating table doesnt have all the productids (only ones that have a rating) and also the rating table is in a different table than the products table so when I use the code below it only shows products that have a rating. Heres an example http://www.tunerplaza.com/c-304-carburetion.aspx?


Heres the sql code For the rating....

ELSE IF @sortEntityName = 5 BEGIN --Sort By Rating

        INSERT #RowNumber (rating) 
        SELECT RT.Productid 
        FROM Rating RT 
        GROUP BY RT.ProductID
        ORDER BY MIN(RT.Rating)

        INSERT #displayorder select rating, displayorder from #RowNumber
END
Last edited by tytyguy : May 4th, 2008 at 6:26 pm.
AddThis Social Bookmark Button
Reply With Quote  

Only community members can participate in forum threads. You must register or log in to contribute.

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

DaniWeb MS SQL Marketplace
Thread Tools Display Modes

Similar Threads
Other Threads in the MS SQL Forum

All times are GMT -4. The time now is 6:51 pm.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC