Hi all again,
Well, I have my Athletics database with Athletes, Competitions, Scores
tables.
I have a ranking query where I get back the list of the
competitions-athletes and scores opportunely sorted.
I also want to be able to:
1) Select just the top <n> best scores [= SELECT TOP <n>]
2) View the multiple equal-score in order of date in which the
competition occurred [=ORDER BY Score, CompetitionDate]
3) Selecting a TOP <n> limit, view more than <n> best scores if the
(n+1)th, (n+2)th,..(n+m) th extra records have the same score than the
<n>th.
Now, actually TOP allows me view more than <n> athletes in case [3]
occurs, but this works just if I ORDER BY Score only, if I order by
CompetitionDate too, extra records do not appear.
So, at the moment, I am able to return a query that meets requirements
[1] And [2]:
SELECT TOP <n> AtheteName, CompetitionDate , CompetitionPlac e, Score
Scores INNER JOIN Athletes … INNER JOIN Competitions
ORDER BY Score,Competiti onDate
…or one that meets req. [1] and [3]:
SELECT TOP <n> AtheteName, CompetitionDate , CompetitionPlac e, Score
Scores INNER JOIN Athletes … INNER JOIN Competitions
ORDER BY Score
…or one that meets req [2] and [3]:
SELECT AtheteName, CompetitionDate , CompetitionPlac e, Score
Scores INNER JOIN Athletes … INNER JOIN Competitions
ORDER BY Score, CompetitionDate
Is there a way to build a query that allows me to meet requirements
[1][2][3] contemporarly ?!?
Thanks a lot.
Regards,
Irene 12 5612
Count me out of replying!
TC
"Irene" <it************ @hotmail.com> wrote in message
news:cc******** *************** ***@posting.goo gle.com... Hi all again,
Well, I have my Athletics database with Athletes, Competitions, Scores tables.
I have a ranking query where I get back the list of the competitions-athletes and scores opportunely sorted.
I also want to be able to: 1) Select just the top <n> best scores [= SELECT TOP <n>] 2) View the multiple equal-score in order of date in which the competition occurred [=ORDER BY Score, CompetitionDate] 3) Selecting a TOP <n> limit, view more than <n> best scores if the (n+1)th, (n+2)th,..(n+m) th extra records have the same score than the <n>th.
Now, actually TOP allows me view more than <n> athletes in case [3] occurs, but this works just if I ORDER BY Score only, if I order by CompetitionDate too, extra records do not appear.
So, at the moment, I am able to return a query that meets requirements [1] And [2]: SELECT TOP <n> AtheteName, CompetitionDate , CompetitionPlac e, Score Scores INNER JOIN Athletes . INNER JOIN Competitions ORDER BY Score,Competiti onDate
.or one that meets req. [1] and [3]: SELECT TOP <n> AtheteName, CompetitionDate , CompetitionPlac e, Score Scores INNER JOIN Athletes . INNER JOIN Competitions ORDER BY Score
.or one that meets req [2] and [3]: SELECT AtheteName, CompetitionDate , CompetitionPlac e, Score Scores INNER JOIN Athletes . INNER JOIN Competitions ORDER BY Score, CompetitionDate
Is there a way to build a query that allows me to meet requirements [1][2][3] contemporarly ?!?
Thanks a lot.
Regards, Irene
Please do not reply to a message that you do not intend to answer. Folks
scanning the newsgroups to help others will assume that someone has already
posted an answer.
--
John Viescas, author
"Microsoft Office Access 2003 Inside Out" (coming soon)
"Running Microsoft Access 2000"
"SQL Queries for Mere Mortals" http://www.viescas.com/
(Microsoft Access MVP since 1993)
"TC" <a@b.c.d> wrote in message news:1065004691 .679397@teuthos ... Count me out of replying!
TC
"Irene" <it************ @hotmail.com> wrote in message news:cc******** *************** ***@posting.goo gle.com... Hi all again,
Well, I have my Athletics database with Athletes, Competitions, Scores tables.
I have a ranking query where I get back the list of the competitions-athletes and scores opportunely sorted.
I also want to be able to: 1) Select just the top <n> best scores [= SELECT TOP <n>] 2) View the multiple equal-score in order of date in which the competition occurred [=ORDER BY Score, CompetitionDate] 3) Selecting a TOP <n> limit, view more than <n> best scores if the (n+1)th, (n+2)th,..(n+m) th extra records have the same score than the <n>th.
Now, actually TOP allows me view more than <n> athletes in case [3] occurs, but this works just if I ORDER BY Score only, if I order by CompetitionDate too, extra records do not appear.
So, at the moment, I am able to return a query that meets requirements [1] And [2]: SELECT TOP <n> AtheteName, CompetitionDate , CompetitionPlac e, Score Scores INNER JOIN Athletes . INNER JOIN Competitions ORDER BY Score,Competiti onDate
.or one that meets req. [1] and [3]: SELECT TOP <n> AtheteName, CompetitionDate , CompetitionPlac e, Score Scores INNER JOIN Athletes . INNER JOIN Competitions ORDER BY Score
.or one that meets req [2] and [3]: SELECT AtheteName, CompetitionDate , CompetitionPlac e, Score Scores INNER JOIN Athletes . INNER JOIN Competitions ORDER BY Score, CompetitionDate
Is there a way to build a query that allows me to meet requirements [1][2][3] contemporarly ?!?
Thanks a lot.
Regards, Irene
Irene-
So, you want the TOP <n> scores, and then list all the records that have
that score, right? First, find the distinct scores:
qryDistinctScor e:
SELECT DISTINCT Score FROM Scores
Now, find the top <n>:
qryTopScores:
SELECT TOP <n> Score
FROM qryDistinctScor e
ORDER BY Score Desc
Now, solve your problem:
SELECT AtheteName, CompetitionDate , CompetitionPlac e, Score
Scores INNER JOIN Athletes . INNER JOIN Competitions
WHERE Score IN
(SELECT Score FROM qryTopScores)
ORDER BY Score, CompetitionDate
--
John Viescas, author
"Microsoft Office Access 2003 Inside Out" (coming soon)
"Running Microsoft Access 2000"
"SQL Queries for Mere Mortals" http://www.viescas.com/
(Microsoft Access MVP since 1993)
"Irene" <it************ @hotmail.com> wrote in message
news:cc******** *************** ***@posting.goo gle.com... Hi all again,
Well, I have my Athletics database with Athletes, Competitions, Scores tables.
I have a ranking query where I get back the list of the competitions-athletes and scores opportunely sorted.
I also want to be able to: 1) Select just the top <n> best scores [= SELECT TOP <n>] 2) View the multiple equal-score in order of date in which the competition occurred [=ORDER BY Score, CompetitionDate] 3) Selecting a TOP <n> limit, view more than <n> best scores if the (n+1)th, (n+2)th,..(n+m) th extra records have the same score than the <n>th.
Now, actually TOP allows me view more than <n> athletes in case [3] occurs, but this works just if I ORDER BY Score only, if I order by CompetitionDate too, extra records do not appear.
So, at the moment, I am able to return a query that meets requirements [1] And [2]: SELECT TOP <n> AtheteName, CompetitionDate , CompetitionPlac e, Score Scores INNER JOIN Athletes . INNER JOIN Competitions ORDER BY Score,Competiti onDate
.or one that meets req. [1] and [3]: SELECT TOP <n> AtheteName, CompetitionDate , CompetitionPlac e, Score Scores INNER JOIN Athletes . INNER JOIN Competitions ORDER BY Score
.or one that meets req [2] and [3]: SELECT AtheteName, CompetitionDate , CompetitionPlac e, Score Scores INNER JOIN Athletes . INNER JOIN Competitions ORDER BY Score, CompetitionDate
Is there a way to build a query that allows me to meet requirements [1][2][3] contemporarly ?!?
Thanks a lot.
Regards, Irene
"John Viescas" <Jo***@nomail.p lease> wrote in news:#m9408BiDH A.1688
@TK2MSFTNGP10.p hx.gbl: Please do not reply to a message that you do not intend to answer. Folks scanning the newsgroups to help others will assume that someone has already posted an answer.
Count me out of replying!
--
Lyle
(for e-mail refer to http://ffdba.com/contacts.htm)
Point taken.
I guess I was really trying to get the OP to think this:
"Gee, if someone tries to help me in a previous thread, & they give me some
information, but ask me a question, & I do not bother to answer them, then I
repost my question a few days later, the person who tried to help me before,
might not bother to try again!"
TC
John Viescas <Jo***@nomail.p lease> wrote in message
news:#m******** ******@TK2MSFTN GP10.phx.gbl... Please do not reply to a message that you do not intend to answer. Folks scanning the newsgroups to help others will assume that someone has
already posted an answer.
Ah. I didn't see the previous exchange. It might have been a good idea to
refer the OP to your original reply and ask what it was they didn't
understand.
--
John Viescas, author
"Microsoft Office Access 2003 Inside Out" (coming soon)
"Running Microsoft Access 2000"
"SQL Queries for Mere Mortals" http://www.viescas.com/
(Microsoft Access MVP since 1993)
"TC" <a@b.c.d> wrote in message news:1065086338 .327113@teuthos ... Point taken.
I guess I was really trying to get the OP to think this:
"Gee, if someone tries to help me in a previous thread, & they give me
some information, but ask me a question, & I do not bother to answer them, then
I repost my question a few days later, the person who tried to help me
before, might not bother to try again!"
TC
John Viescas <Jo***@nomail.p lease> wrote in message news:#m******** ******@TK2MSFTN GP10.phx.gbl... Please do not reply to a message that you do not intend to answer.
Folks scanning the newsgroups to help others will assume that someone has already posted an answer.
"John Viescas" <Jo***@nomail.p lease> wrote in message news:<e5******* *******@TK2MSFT NGP11.phx.gbl>. .. Irene-
Now, solve your problem:
SELECT AtheteName, CompetitionDate , CompetitionPlac e, Score Scores INNER JOIN Athletes . INNER JOIN Competitions WHERE Score IN (SELECT Score FROM qryTopScores) ORDER BY Score, CompetitionDate
Thanks for your help John. This definitely solve my problem.
I still need to be familiar with subqueries....
Regards,
Irene
Hi TC,
I see you have a problem with me.
Actually, I did reply you in the other thread. This was the message:
----
Hi TC,
Someonelse gave me this address: http://www.mvps.org/access/queries/qry0020.htm
It looks like I have a solution for my problem.
However I have still a couple of problems, complications due to the
major complexity of my database in comparison to the Library database
(see the linked page).
But I will open an new post for these as soon as I can manage to
phrase
them correctly.
Thanks for your time.
Irene
----
I don't know why your reply didn't go on the newsserver. I'm using a
web interfaced newsreader. Maybe it is not so reliable or maybe my
post has been deleted for some reasons that I don't know.
See also my replies to Steve in comp.lang.basic .visual.databas e and to
Michel in microsoft.publi c.access.querie s on the same subject [Best
athletes...].
Why didn't I crossposted? Because mailgate.org does not manage
"microsoft.publ ic" groups!
I will use Google from now on, even if it takes so long to see your
message (and the possible replies). Or I will look for some others.
Cannot use newsreaders from here.
In any case, sorry if this has caused misunderstandin gs, it was not
intentional.
Regards,
Irene Point taken.
I guess I was really trying to get the OP to think this:
"Gee, if someone tries to help me in a previous thread, & they give me some information, but ask me a question, & I do not bother to answer them, then I repost my question a few days later, the person who tried to help me before, might not bother to try again!"
TC
Ok. I apologise!
That message did not appear on my server. This has happened before, so I
should have thought of that.
Sorry to go off half-cocked,
TC
Irene <it************ @hotmail.com> wrote in message
news:cc******** *************** ***@posting.goo gle.com... Hi TC,
I see you have a problem with me.
Actually, I did reply you in the other thread. This was the message:
---- Hi TC,
Someonelse gave me this address: http://www.mvps.org/access/queries/qry0020.htm
It looks like I have a solution for my problem.
However I have still a couple of problems, complications due to the major complexity of my database in comparison to the Library database (see the linked page).
But I will open an new post for these as soon as I can manage to phrase them correctly.
Thanks for your time. Irene ----
I don't know why your reply didn't go on the newsserver. I'm using a web interfaced newsreader. Maybe it is not so reliable or maybe my post has been deleted for some reasons that I don't know.
See also my replies to Steve in comp.lang.basic .visual.databas e and to Michel in microsoft.publi c.access.querie s on the same subject [Best athletes...]. Why didn't I crossposted? Because mailgate.org does not manage "microsoft.publ ic" groups!
I will use Google from now on, even if it takes so long to see your message (and the possible replies). Or I will look for some others. Cannot use newsreaders from here.
In any case, sorry if this has caused misunderstandin gs, it was not intentional.
Regards, Irene
Point taken.
I guess I was really trying to get the OP to think this:
"Gee, if someone tries to help me in a previous thread, & they give me
some information, but ask me a question, & I do not bother to answer them,
then I repost my question a few days later, the person who tried to help me
before, might not bother to try again!"
TC This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Petre Huile |
last post by:
I have designed a site for a client, but they have hired an internet
marketing person to incrase their search engine ranking and traffic.
He wants to put extra-large fonts on every page which will make the
design looks a bit rediculous. He also said that the big text cannot
be hidden. I am just trying to find a compromise. Here are the
questions:
(1) Is it true that a page with an <H1> tag and very big font size
will make a search...
|
by: mjweiner |
last post by:
This one has been stumping me for several days. I can run a query that
returns several different items from several different manufacturers,
each with a ranking score. Each manufacturer can have any number of
items:
Item_Name Manufacturer rank
Item 1 Manu_A 82
Item 2 Manu_A 65
Item 3 Manu_A 41
Item 4 Manu_B 32
|
by: Joseph Bloch |
last post by:
In all the threads on ranking in Access queries, I've not seen
anything that deals with ranking against a subset of the query
results. What I need to do is take the following query results:
Dept Subdept Amount
AAA A1 75
AAA A2 13
AAA A3 45
BBB B1 4
BBB B2 16
|
by: macmorten |
last post by:
Hi,
I have a table with a list of companies, with fields like this
(simplyfied):
ID (int, auto_increment)
CompanyName (text)
ContactPerson (text)
Description (text)
Partner (int)
|
by: sara |
last post by:
I hope someone can help with this.
Our director wants to have a report that will have the departments
(Retail stores) across the top, stores down the side and the RANKING of
the YTD dept sales within the chain in the cell.
Store/Dept 1 2 3 4
B 8 1 5 2
R 1 3 2 6
(etc.)
| |
by: AnndieMac |
last post by:
I have an Access 2002 database of inventory count results, and I have been asked to create summaries of the items with the most losses at a store, region and national level. Individually, I have been able to create these summaries easily enough using several sorted queries and a form to select the specific store, or to pull up the regional or national summaries.
The problem is that they want to be able to have one file for each store which...
|
by: Chris |
last post by:
I was wodering if there was a way to rank numbers in a query like this
#'s Rank
100 1
99 2
98 3
98
97 5
96 6
96
|
by: orliski109 |
last post by:
Can someone help me get the total and getting the ranking of the totals following the data below using a query:
No - J1 - J2 - J3 - J4 - J5 - Total - Rank
01 - 10 - 10 - 15 - 20 - 30 - 85 - 2
02 - 10 - 15 - 15 - 10 - 10 - 60 - 4
03 - 15 - 20 - 20 - 15 - 25 - 95 - 1
04 - 20 - 10 - 10 - 10 - 10 - 60 - 4
05 - 15 - 15 - 20 - 10 - 20 - 80 - 3
|
by: kevinlhamiltonsr |
last post by:
INSERT INTO ( CC, HeldPayAccounts, ASG, , Command, OrderNo, , )
SELECT .CC, .HeldPayAccounts, .ASG, ., .Command, .OrderNo, . AS Expr2, (Select count(.) from as
where
((. >= .)
and (. = .))) AS Rank
FROM
GROUP BY .CC, .HeldPayAccounts, .ASG, ., .Command, .OrderNo, .
ORDER BY .OrderNo;
The above statement is in MS Access 2003 SQL view of Query. Some where I need to add the
"Select ROW_NUMBER() over (Partition by item order by...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
| |
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |