Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9164091
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T14:35:54+00:00 2026-06-17T14:35:54+00:00

$query=SELECT title, max(postid) FROM post; postid is a increasing numeric value (1,2,3…) . At

  • 0
$query="SELECT title, max(postid) FROM post";

postid is a increasing numeric value (1,2,3...). At the moment, the highest value is 49, but It’s pulling up 1. It seems to be ignoring the MAX statement.

otherwise everything else is working great.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T14:35:55+00:00Added an answer on June 17, 2026 at 2:35 pm

    That’s not valid syntax, which engine is running it?

    You either need:

     SELECT title, max(postid) FROM post GROUP BY title;
    

    to get multiple records, one for each title, showing the max postid for each title, or

    SELECT max(postid) FROM post
    

    to get the single max postid from the table.

    If you want the highest postid and the title that goes with it, you need

     SELECT TOP 1 title, postid FROM post ORDER BY postid DESC
    

    or

     SELECT title, postid FROM post ORDER BY postid DESC LIMIT 1
    

    depending on your SQL engine.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I run this query: SELECT u.user_id, u.fname, u.lname, n.title, n.news_id, n.post, n.zip, z.city,z.state_abbr FROM
The sql query: select id,title from blog_post inner join (select object_pk, max(submit_date) from django_comments
SQL query: SELECT ArticleCategories.Title AS Category, Articles.Title, Articles.[Content], Articles.Date FROM ArticleCategories INNER JOIN Articles
I have the next mysql query: $productn = $jdb->query('SELECT t2.title FROM '.DB_PREFIX.'shopping_cart AS t1
Using sqlite3, if my query is SELECT * FROM table WHERE title LIKE '%x%'
I have the following query: SELECT m.*, COUNT(c.chapter_nr) as chapters, MAX(c.chapter_nr) as latest_chapter FROM
I have this MySql query : SELECT forum_categories.title, forum_messages.author, forum_messages.date AS last_message FROM forum_categories
Ok, this is my query: SELECT video_category, video_url, video_date, video_title, short_description, MAX(video_id) FROM videos
I have this query: SELECT p.id, r.status, r.title FROM page AS p INNER JOIN
In sql server 2008, I have the following query: select c.title as categorytitle, s.title

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.