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

  • SEARCH
  • Home
  • 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 8794371
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T23:14:32+00:00 2026-06-13T23:14:32+00:00

I am writing website using play 2.0 framework. And I have a problem when

  • 0

I am writing website using play 2.0 framework. And I have a problem when parsing results.
This request to mysql db gets all the links(can be several per episode) added to the database per episode together with all the information about episode and anime.

  def lastReleasedLink(limit:Long=5):List[(((Episode,Anime),Link),Genre)] = {
    DB.withConnection { implicit c =>
      SQL(
        """
          select * from yas_episodes as a
          inner join anime as b on a.ep_anime_id=b.id
          left outer join yas_links as c on a.ep_id=c.ep_id
          LEFT JOIN yas_animes_genres AS d ON a.ep_anime_id = d.ag_anime_id
          INNER JOIN yas_genres AS e ON e.g_id = d.ag_genre_id
          where c.ep_id IS NOT NULL group by c.ep_id order by c.date desc limit {limit}
        """).on('limit ->limit)as(Episode.simple~Anime.simple~Link.simple~Genre.simple map{
        case episode~anime~link~genre => episode -> anime -> link -> Genre
      } *)
    }
  }

The return value is type of List[(((Episode,Anime),Link),Genre)]
but how can I form output to the list of
let say List[episode,anime,Seq[links]] or List[episode,anime,Seq[Genres],Seq[links]] don’t know where to put genres.

You can imagine that when you have two links per one episode information from table anime and yas_episodes will be copied for every row. So I need somehow stack them together(group) by episode record. Then it will be possible to iterate list and access to all objects.

As you can see, in the request there is many-to-many relation of anime with genres.
I have no idea how can I put all together to one list to be able to access it in view. Should Genre be part of Anime model?

  • 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-13T23:14:33+00:00Added an answer on June 13, 2026 at 11:14 pm

    It seems that the preferred way to achieve this is using the Scala collection API, see this post by Guillaume Bort.

    In your case, I think you could do something like

    lastReleasedLink groupBy { case (((e, a), l), g) => (e, a) }
    

    to group by (Episode, Anime). Generally speaking, those manipulations are probably a little easier if you change your function to return a List[(Episode, Anime, Link, Genre)], i.e.

    case episode~anime~link~genre => (episode, anime, link, genre)
    

    then you could achieve the same with this code:

    lastReleasedLink groupBy ((_._1, _._2))
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm writing a MVC website and using jqGrid. I have managed to get it
I'm writing a WP7 app which gets website information using WebClient 's DownloadStringAsync method.
I am writing my website's backend using Flask and Python 2.7, and have run
I'm writing a website using JSP. I want to have the website available in
I'm writing my first website using php/mysql, and jquery. For the next part, the
I'm writing a website/iPad app (using PhoneGap ), where I have 1024x768 images on
Hi, I am going to build a classifieds website using PHP/MySQL. This website is
I am writing a website using C# razor code. I'm a total newbie when
I'm writing a website in ASP.NET MVC, using the ASP.NET MVC 1.0 template that
I'm writing my Website right now, trying to stay more conservative, but using newer

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.