Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Database > SQL Language
Password Reminder
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
SQL Language SQL Language discussions not specific to a particular RDBMS program or vendor.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the SQL Language section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old January 10th, 2011, 03:33 PM
TCB TCB is offline
Registered User
Join Date: Jan 2011
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Changing 5098 to the Last Number in a Rank Plus One?

Would someone please take a look at my database and help me find a way to change the “5089” to just be the last number in my ranking.

So in 3MonthRank all the “5089’s” should be 692
And in 6MonthRank all the “5089’s” should be 750

I’m hoping there is a easy way to do this.

The attached will show you exactly what I’m asking

I really appreciate you taking the time to help.

Below is the code if that helps.

SELECT Wholesale_Group_1_export_tbl.[OMNI#],

[sql](Select count(*) from Wholesale_Group_1_export_tbl as B where Wholesale_Group_1_export_tbl.[3MonthTotalRecord$] < B.[3MonthTotalRecord$]+1) AS 3MonthRank,

(Select count(*) from Wholesale_Group_1_export_tbl as B where Wholesale_Group_1_export_tbl.[6MonthTotalRecords$] < B.[6MonthTotalRecords$]+1) AS 6MonthRank,

(Select count(*) from Wholesale_Group_1_export_tbl as B where Wholesale_Group_1_export_tbl.[9MonthTotalRecords$] < B.[9MonthTotalRecords$]+1) AS 9MonthRank, Wholesale_Group_1_export_tbl.[9MonthTotalRecords$], Wholesale_Group_1_export_tbl.[9MonthTotalRecords#], (Select count(*) from Wholesale_Group_1_export_tbl as B where Wholesale_Group_1_export_tbl.[12MonthTotalRecord$] < B.[12MonthTotalRecord$]+1) AS 12MonthRank, Wholesale_Group_1_export_tbl.[12MonthTotalRecord$], Wholesale_Group_1_export_tbl.[12MonthTotalRecords#] INTO RankTable_tbl

FROM Wholesale_Group_1_export_tbl
ORDER BY Wholesale_Group_1_export_tbl.[3MonthTotalRecord$] DESC , Wholesale_Group_1_export_tbl.[6MonthTotalRecords$] DESC , Wholesale_Group_1_export_tbl.[9MonthTotalRecords$] DESC;[/sql]
Reply With Quote

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Rank items into quartiles 0x1d22 XSLT 2 September 26th, 2008 04:37 AM
Change in forum rank kherrerab BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 3 December 18th, 2006 10:39 AM
changing numeric string to number not possible? Brian Campbell XSLT 1 November 16th, 2006 06:36 PM
MS RS Changing Server port Number jcredk BOOK: Professional SQL Server Reporting Services ISBN: 0-7645-6878-7 0 September 2nd, 2004 03:48 AM
Changing number to words kekohchaa VS.NET 2002/2003 3 April 7th, 2004 11:27 PM

All times are GMT -4. The time now is 01:57 PM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.