Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Microsoft Office > Access and Access VBA > Access
|
Access Discussion of Microsoft Access database design and programming. See also the forums for Access ASP and Access VBA.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old January 7th, 2005, 03:44 AM
Registered User
 
Join Date: Jan 2005
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Found the solution but do'nt know how to implement

Hi,
I wrote the query below and everything works fine except that the rank does not display correctly in the case of a tie. The calculated rank after the ties would not be correct due to this code in the query:
Code:
(SELECT COUNT(*) + 1
       FROM History H INNER JOIN
            Lifter L ON L.uidLifter = H.uidLifterRef
       WHERE H.ScoreTotal > History.ScoreTotal AND 
            L.Gender = Lifter.Gender) AS Rank


I found a solution to the problem, in the link below, but I must admit that I have no clue on how to implement that solution in my query to solve the problem. I know that I have to write two small queries that will be used in this larger one.

Here is the link to the solution : http://support.microsoft.com/kb/207626/EN-US/
The database can be downloaded from http://www.reitzgh.co.za/add/Database.zip

Make sure to update the MeetDate in the Meet table to reflect the current date before you try to run the query.

Code:
SELECT (SELECT COUNT(*) + 1
       FROM History H INNER JOIN
            Lifter L ON L.uidLifter = H.uidLifterRef
       WHERE H.ScoreTotal > History.ScoreTotal AND 
            L.Gender = Lifter.Gender) AS Rank, 
    Lifter.LifterNumber AS LifterNumber, 
    Lifter.Lastname AS Lastname, Lifter.Firstname AS Firstname, 
    Lifter.BodyWeight, Class.Description AS CDescription, 
    Activity.Description AS GDescription, A.Name AS NameA, 
    History.ScoreA, History.SubTotalA, B.Name AS NameB, 
    History.ScoreB, History.SubTotalB, C.Name AS NameC, 
    History.ScoreC, History.SubTotalC, 
    History.ScoreTotal AS ScoreTotal
FROM Class, Lifter, Team, History, Meet, Activity, Events A, 
    Events B, Events C
WHERE History.ScoreTotal > 0 AND 
    Class.uidClass = Lifter.uidClassRef AND 
    Lifter.uidTeamRef = Team.uidTeam AND 
    Lifter.uidLifter = History.uidLifterRef AND 
    Team.uidMeetRef = Meet.uidMeet AND 
    Lifter.Gender = Activity.Code AND 
    Meet.uidEventsA = A.uidEvents AND 
    Meet.uidEventsB = B.uidEvents AND 
    Meet.uidEventsC = C.uidEvents AND 
    Team.TeamStatus = 0 AND Lifter.LifterStatus = 0 AND 
    (MeetDate = DATE ())
GROUP BY History.ScoreTotal, uidClassRef, Lifter.LifterNumber, 
    Lifter.Lastname, Lifter.Firstname, Lifter.BodyWeight, 
    Class.Description, History.WeightScoreC, Lifter.Gender, 
    Activity.Description, Activity.Activity, Lifter.LifterStatus, 
    A.Name, B.Name, C.Name, History.ScoreA, History.ScoreB, 
    History.ScoreC, History.SubTotalA, History.SubTotalB, 
    History.SubTotalC
HAVING (Activity.Activity = 'GenderStatus') AND 
    (Lifter.LifterStatus = 0)
ORDER BY Lifter.Gender ASC, History.ScoreTotal DESC, 
    VAL(Class.Description) DESC, Lifter.BodyWeight ASC
 
Old January 7th, 2005, 05:43 PM
Registered User
 
Join Date: Jan 2005
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Well, it looks like you posted the script for one query? If you have an example database that readily fits your problem then it should fairly easy to plug-in your values for theirs. Are you getting errors or just having trouble implementing?

-- WillYum

 
Old January 10th, 2005, 02:13 AM
Registered User
 
Join Date: Jan 2005
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi WillYum,
  This is one of the scripts that I would like to have changed to reflect the correct ranking with ties. I guess anything can go to solve the problem, I only found the code on MS and it look like a solution to my problem. I tried it but got stucked. I believe that if I can solve the problem to this script then I should be able to convert the others I have fairly easy.

Below is a link to a database that I use with sample data.

http://www.reitzgh.co.za/add/Database.zip

Regards





Similar Threads
Thread Thread Starter Forum Replies Last Post
Trying to implement AJAX Maxxim ASP.NET 2.0 Professional 2 October 22nd, 2007 01:35 PM
how can i implement thread in servlet?. spmanivel Servlets 3 September 14th, 2006 08:25 AM
how to implement this?please help? Desmond Classic ASP Databases 1 May 27th, 2005 11:06 PM
Cannot implement or extend Rusk Apache Tomcat 1 June 16th, 2004 06:29 AM
how can i best implement a many to many relation? Haroldd Access 1 July 2nd, 2003 03:57 PM





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