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 263197
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T22:34:53+00:00 2026-05-11T22:34:53+00:00

This is the query. Im mostly interested if there is a better way to

  • 0

This is the query. Im mostly interested if there is a better way to grab the stuff I use GROUP_CONCAT for, or if thats a fairy good way of grabbing this data. I then explode it, and put the ids/names into an array, and then use a for loop to echo them out.

SELECT 
    mov_id, 
    mov_title, 
    GROUP_CONCAT(DISTINCT categories.cat_name) as all_genres, 
    GROUP_CONCAT(DISTINCT cat_id) as all_genres_ids,  
    GROUP_CONCAT(DISTINCT case when gen_dominant = 1 then gen_catid else 0 end) as dominant_genre_ids, 
    GROUP_CONCAT(DISTINCT actors.act_name) as all_actors, 
    GROUP_CONCAT(DISTINCT actors.act_id) as all_actor_ids, 
    mov_desc, 
    mov_added, 
    mov_thumb, 
    mov_hits, 
    mov_numvotes, 
    mov_totalvote, 
    mov_imdb, 
    mov_release, 
    mov_html, 
    mov_type,
    mov_buytickets,
    ep_summary,
    ep_airdate,
    ep_id,
    ep_hits,
    ep_totalNs,
    ep_totalRs,
    mov_rating,
    mov_rating_reason,
    mrate_name,
    dir_id, 
    dir_name
FROM movies
LEFT JOIN _genres
    ON movies.mov_id = _genres.gen_movieid
LEFT JOIN categories
    ON _genres.gen_catid = categories.cat_id
LEFT JOIN _actors
    ON (movies.mov_id = _actors.ac_movid)
LEFT JOIN actors
    ON (_actors.ac_actorid = actors.act_id AND act_famous = 1)
LEFT JOIN directors
    ON movies.mov_director = directors.dir_id
LEFT JOIN movie_ratings
    ON movies.mov_rating = movie_ratings.mrate_id
LEFT JOIN episodes
    ON mov_id = ep_showid AND ep_season = 0 AND ep_num = 0
WHERE mov_id = *MOVIE_ID* AND mov_status = 1 
GROUP BY mov_id

EXPLAIN of the query is here

alt text http://www.krayvee.com/o2/explain.gif

  • 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-05-11T22:34:53+00:00Added an answer on May 11, 2026 at 10:34 pm

    Personally, I would try to break the query up into multiple queries. Mostly I would recommend removing the Actor and Genre Joins so that you can get rid of all those group_concat functions. Then do separate queries to pull this data out. Not sure if it would speed things up, but it’s probably worth a shot.

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

Sidebar

Related Questions

I feel like there is a better way to do this. I'm mostly just
This query is failing (RavenDB 1.0.701) var items= RavenSession.Query<Item>().Where(x => 161 193.StartsWith(x.MaterializedPath)).ToList(); Is there
This is mostly a request for comments if there is a reason I should
This query gives me syntax error in when-between line. how can i solve them?
This query selects all the unique visitor sessions in a certain date range: select
This query works: item = db.GqlQuery(SELECT * FROM Item WHERE CSIN = 13)[0] although
This query that I have is returning therapists whose 'therapistTable.activated' is equal to false
This query takes about 52 seconds to complete. It appears 82% of the time
This query takes ~4 seconds to complete: SELECT DISTINCT resources_resource.id, resources_resource.heading, resources_resource.name, resources_resource.old_name, resources_resource.clean_name,
Take this query: SELECT * FROM MyTable WHERE MyColumn = 'SomeValue' ORDER BY SomeFakeQualifier.MyColumn

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.