473,397 Members | 1,960 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,397 software developers and data experts.

problem with highscore

Hi folks

I have a little problem converting from an access database to the SQL
server
I need to have a highscore that shows the top 10 scores, grouped by
email.

In my access db i had this query:
"SELECT TOP 10 First(users.user_naam) AS FirstOfuser_naam,
First(users.user_voornaam) AS FirstOfuser_voornaam,
Max(scores.score_score) AS MaxOfscore_score FROM users, scores WHERE
scores.score_userid=[users].[user_id] GROUP BY users.user_email ORDER
BY Max(scores.score_score) DESC"

But in SQL Server, First isn't known, and without it, i get:
... is invalid in the select list because it is not contained in either
an aggregate function or the GROUP BY clause

How can i make it show the top 10 scores, but with no duplicates of
email.
ex:
SELECT users.user_naam, users.user_voornaam,scores.score_score,
users.user_email FROM users, scores WHERE scores.score_userid =
users.user_id

this is the query for selecting all

Someone knows a solution?

Thx

Jun 25 '07 #1
2 1817
You might try substituting MIN (or MAX) for FIRST. This will return the
same result as long as user_naam and user_voornaam values are the same for a
given user_email value.

If user_naam and user_voornaam values differ for a given user_email, you'll
need to specify your requirements for which of those values should be
returned. If you really don't care, MIN/MAX will suffice but the values
might be different than the original Access query.

--
Hope this helps.

Dan Guzman
SQL Server MVP

"zuuperman" <ni**********@gmail.comwrote in message
news:11**********************@o61g2000hsh.googlegr oups.com...
Hi folks

I have a little problem converting from an access database to the SQL
server
I need to have a highscore that shows the top 10 scores, grouped by
email.

In my access db i had this query:
"SELECT TOP 10 First(users.user_naam) AS FirstOfuser_naam,
First(users.user_voornaam) AS FirstOfuser_voornaam,
Max(scores.score_score) AS MaxOfscore_score FROM users, scores WHERE
scores.score_userid=[users].[user_id] GROUP BY users.user_email ORDER
BY Max(scores.score_score) DESC"

But in SQL Server, First isn't known, and without it, i get:
.. is invalid in the select list because it is not contained in either
an aggregate function or the GROUP BY clause

How can i make it show the top 10 scores, but with no duplicates of
email.
ex:
SELECT users.user_naam, users.user_voornaam,scores.score_score,
users.user_email FROM users, scores WHERE scores.score_userid =
users.user_id

this is the query for selecting all

Someone knows a solution?

Thx
Jun 25 '07 #2
I'm not entirely sure I understand the desired results, but you might
try something like this.

SELECT TOP 10
users.user_naam,
users.user_voornaam,
MAX(scores.score_score) as MaxScore,
users.user_email
FROM users
JOIN scores
ON scores.score_userid = users.user_id
GROUP BY users.user_naam,
users.user_voornaam,
users.user_email
ORDER BY MaxScore DESC

Roy Harvey
Beacon Falls, CT

On Mon, 25 Jun 2007 02:59:56 -0700, zuuperman <ni**********@gmail.com>
wrote:
>Hi folks

I have a little problem converting from an access database to the SQL
server
I need to have a highscore that shows the top 10 scores, grouped by
email.

In my access db i had this query:
"SELECT TOP 10 First(users.user_naam) AS FirstOfuser_naam,
First(users.user_voornaam) AS FirstOfuser_voornaam,
Max(scores.score_score) AS MaxOfscore_score FROM users, scores WHERE
scores.score_userid=[users].[user_id] GROUP BY users.user_email ORDER
BY Max(scores.score_score) DESC"

But in SQL Server, First isn't known, and without it, i get:
.. is invalid in the select list because it is not contained in either
an aggregate function or the GROUP BY clause

How can i make it show the top 10 scores, but with no duplicates of
email.
ex:
SELECT users.user_naam, users.user_voornaam,scores.score_score,
users.user_email FROM users, scores WHERE scores.score_userid =
users.user_id

this is the query for selecting all

Someone knows a solution?

Thx
Jun 25 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Sarah | last post by:
Hello! Does anybody know a script for a puzzle with Highscore? Many thanks before, Sarah
117
by: Peter Olcott | last post by:
www.halting-problem.com
11
by: ian.davies52 | last post by:
Is there anything I can do about the apparent limit on the number of textboxes that have calculations as their control source on a form or report in ms-access? I have a query that pulls together...
28
by: Jon Davis | last post by:
If I have a class with a virtual method, and a child class that overrides the virtual method, and then I create an instance of the child class AS A base class... BaseClass bc = new ChildClass();...
6
by: Ammar | last post by:
Dear All, I'm facing a small problem. I have a portal web site, that contains articles, for each article, the end user can send a comment about the article. The problem is: I the comment length...
16
by: Dany | last post by:
Our web service was working fine until we installed .net Framework 1.1 service pack 1. Uninstalling SP1 is not an option because our largest customer says service packs marked as "critical" by...
30
by: MaxLindquist | last post by:
Hi! I want to make a highscore for a game i am making. How might i do that? Thanks
0
by: sontran | last post by:
Hi I've a serious problem with IIS when use Loadvariables inf flash 8 to send the highscore of a game. Do you have any experience with this? The flash can send highscore if I use PHP on Apache...
21
by: cromoglic | last post by:
Hello! I have been making a "guess what number the computer thinks of"-game in python (text-only) for educational reasons. Now, i want to implement a highscore in the code, which writes the best...
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
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,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.