[Resolved] Why does adding GROUP BY always return the MAX?
Even if I apply MIN() to a field in a select statement. The get_row() always returns the max when hosting a GROUP BY.
it’s almost like adding GROUP BY ignores any MAX() or MIN() code and solely returns the max of the query.
[oh, thought I should also key this information, I’m working with php queries $wpdb->get_row()]
[I’m also calling post’s based on category, then simply grouping them by the category to get one result: here’s the code]
$NSeason = $wpdb->get_row(" SELECT MIN(post_episode) as post_episode, post_title FROM $wpdb->posts key1 INNER JOIN $wpdb->term_relationships key2 on key1.ID = key2.object_id WHERE key2.term_taxonomy_id = $thiscat->id AND key1.post_status = 'publish' AND key1.post_type = 'post' AND key1.post_season = $post->post_season + 1 GROUP BY key2.term_taxonomy_id ");
- The topic ‘[Resolved] Why does adding GROUP BY always return the MAX?’ is closed to new replies.