0

I have multiple tables on specific database and each table similar to each other.

Table:

 id     series     folder
  1      Naruto     670
  2      Naruto     671
  3      Naruto     672

Each table has exact setup. Just series name changes. I want to pick up only 1 entry from series row and highest number from the folder row. I will use this data to make it php array and use it for JSON data. Here is my code:

'SELECT naruto.MAX(klasor), naruto.seri, one_piece.MAX(klasor), one_piece.seri, bleach.MAX(klasor), bleach.seri FROM `naruto` INNER JOIN `one_piece` INNER JOIN `bleach ON` LIMIT 1'
1
  • what happens when you have a typo and Naruto is supposed to be Narutu Commented Jun 10, 2015 at 22:34

1 Answer 1

1

Use a GROUP BY clause like

select id,series,max(folder) as max_folder
from table1
group by series
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.