• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Bear Bibeault
  • Paul Clapham
  • Jeanne Boyarsky
Sheriffs:
  • Devaka Cooray
  • Junilu Lacar
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Ron McLeod
  • Tim Holloway
  • Claude Moore
  • Stephan van Hulst
Bartenders:
  • Winston Gutkowski
  • Carey Brown
  • Frits Walraven

Inner Join returning multiple rows - ONLY want MAX(date) record  RSS feed

 
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The Query:


The RESULT: (For example, I only want the max(date) record of 'Scott Byerly' '3')


 
Marshal
Posts: 24195
54
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Shouldn't you group by S.FIRSTNAME and S.LASTNAME as well, then?
 
Kieth Lyman
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the reply Paul.  When I added:



I still get all the rows:
 
Paul Clapham
Marshal
Posts: 24195
54
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Maybe that SQL is too complicated for me to understand, but shouldn't the output be including all the columns from SE?
 
Ranch Hand
Posts: 277
2
Fedora Netbeans IDE Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Its possible that it's because you are grouping by the max.   If you take a look at this link

https://stackoverflow.com/questions/6298703/max-group-by-and-order-by?rq=1

Theres a working example of only showing one of those rows.  It is grouped by only the id.  Worth a try
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!