MaxID Query - Bill

Results 1 to 2 of 2

Thread: MaxID Query - Bill

  1. #1
    Join Date
    Dec 1969

    Default MaxID Query - Bill

    Hi Bill,<BR><BR>The suggestion you gave:<BR>SELECT COUNT(*) AS TheCount, Max(ID) AS TheID <BR>FROM table <BR>WHERE name = &#039;John&#039; <BR><BR>Now, that will only get you the ID of the highest John. You&#039;ll need another query then to get the full info on him: <BR><BR>SELECT * FROM table WHERE ID = ### <BR><BR>What if I want the ID which is the lowest of 3 e.g. ID = 22, ID = 33, ID = 55, etc and only return the one which has the lowest ID.<BR><BR>Thanks!

  2. #2
    Join Date
    Dec 1969

    Default Then use MIN(ID) ...

    ...instead of MAX(ID)<BR><BR>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts