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

  • Home
  • SEARCH
  • 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

This query works great: var pageObject = (from op in db.ObjectPermissions join pg in
This query is related to this one I asked yesterday. I have a radio
this query will just one row as a result myDataContext db = new myDataContext();
In this query: SELECT COUNT(*) AS UserCount, Company.* FROM Company LEFT JOIN User ON
I have this query in sql server 2000: select pwdencrypt('AAAA') which outputs an encrypted
I have this query statement and want to only get records that has a
In SQL server 2005 this query select len(cast('the quick brown fox jumped over the
I'm using this query to get all employees of {clients with name starting with
I have this query in LINQ to Entities. var query = (from s in
What's wrong with this query: INSERT INTO Users( weight, desiredWeight ) VALUES ( 160,

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.