473,385 Members | 1,325 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Proper Setup of Rank Tables

I’m working on setting up ranking table that should rank 3 months apps. 6 months apps and 12 month apps.

The ranks should be laid out from 1-total number of records.
For some reason it’s not do this.

Could someone please take a look at the code below or the attached database and help me understand why my formulas are not working out.

I really appreciate the time and help, I’ve been working on this all weekend

Corey

[sql]SELECT Wholesale_Group_1_export_tbl.[OMNI#], Wholesale_Group_1_export_tbl.[3MonthTotalRecords#],
(Select count(*) from Wholesale_Group_1_export_tbl as B where Wholesale_Group_1_export_tbl.[3MonthTotalRecords#] < B.[3MonthTotalRecords#]) AS 3MonthRank, Wholesale_Group_1_export_tbl.[6MonthTotalRecords#],
(Select count(*) from Wholesale_Group_1_export_tbl as B where Wholesale_Group_1_export_tbl.[6MonthTotalRecords#] < B.[6MonthTotalRecords#]) AS 6MonthRank,
Wholesale_Group_1_export_tbl.[12MonthTotalRecords#],
(Select count(*) from Wholesale_Group_1_export_tbl as B where Wholesale_Group_1_export_tbl.[12MonthTotalRecords#] < B.[12MonthTotalRecords#]) AS 12MonthRank
FROM Wholesale_Group_1_export_tbl;[/sql]
Attached Files
File Type: zip NewDB.zip (137.9 KB, 63 views)
Jan 10 '11 #1
4 1106
Rabbit
12,516 Expert Mod 8TB
Your table alias needs to be in the outer query so that the subquery can reference the outer table.
Jan 10 '11 #2
ADezii
8,834 Expert 8TB
Aside from what Rabbit has stated, shouldn't the following Fields be NUMERIC? They are currently defined as TEXT:
Expand|Select|Wrap|Line Numbers
  1. [3MonthTotalRecords#]
  2. [6MonthTotalRecords#]
  3. [9MonthTotalRecords#]
  4. [12MonthTotalRecords#]
Jan 10 '11 #3
Can yuo help me understand how I would set the outer query so that the subquery can reference the outer table
Jan 10 '11 #4
Rabbit
12,516 Expert Mod 8TB
Expand|Select|Wrap|Line Numbers
  1. SELECT UniqueID,
  2. (SELECT Description FROM Table1 WHERE x.UniqueID = Table1.UniqueID) AS Desc
  3. FROM Table1 AS x
  4.  
Jan 10 '11 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Alexis | last post by:
Is there any option of formatting the columns of tables so that for example only 5 characters of each column is displayed?(also is there any way to set no wrapping) That is in order to get a...
1
by: MB | last post by:
I need to develop a Cold Fusion application using SQL tables, I am not sure how to setup my tables or that this is the optimal way of setting my tables for the application that I am trying top...
1
by: R. de Laat | last post by:
Hi there, I recently started writing perl and i like it more and more. Syntax is something you can easily learn from a book and then just do it. You will get better as you go. But i seem to...
3
by: Random Person | last post by:
Does anyone know how to use VBA to relink tables between two MS Access databases? We have two databases, one with VBA code and the other with data tables. The tables are referenced by linked...
4
by: Paul .V. | last post by:
I need to setup two tables with default information. First off I need a company table. Quite simple. Name, Address, phone, tax number and so on. So I have setup that table with the fiels...
3
by: BPDudeMan | last post by:
Hi There, I've got one table that is constantly being added to (every few seconds). I've got a bunch of users that need to report from this table. What's the best way to setup the tables? ...
2
by: orenlevy1 | last post by:
Hi Everyone. I have a problem that I could not figure out what to do with it. I have a couple of tables and views. All have the same unique ID. When a user try to do a search on our web site...
1
by: cerise | last post by:
I'm using a Linked list stack with objects. I figured out the reason for my earlier problem (where I couldn't access "rank" and "suit" from one of the objects in my stack), and it was because my...
2
by: mo/-/sin | last post by:
i made a table in sql server 2005 and there is column name dateofjoining... but whenever i insert a value in this column it shows some other value........ suppose i insert 2005-09-25 but it shows...
1
by: Justin | last post by:
We have a table that is growing quickly and would like to partition it by date. However, the table does not have a date field. With another table, we are able to create a link to bring in the...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.