-
Max function using where option
Hi All,
I am writing a query where i can get the maximum Id and its name. So iam using this option Max. But this is giving me error.
SELECT Id,Name FROM `User` WHERE Id = Max(Id);
When i submit this query iam getting error
Invalid use of group function
After this i also want query for my second largest Id i am having. Anyone help me in this issue
-
-
Have you tried something like MAX(colname.ID)? It might be using ID as the same as the current entry and having a "max" of a single value doesn't mean anything (or its irrelevant if so). Just a thought. I'm not sure about this.
Daniel -
Freelance Web Design | <?php?> | <html>| español | Deutsch | italiano | português | català | un peu de français | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum
-
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
Bookmarks