+11

SQL question/problem

Hi, Its kind of hard to explain so i'll attatch an image. I'am basically trying to group the genres collumn somehow. Image: https://vkdev.be/Aantekening%202018-12-22%20185016.jpg

12/22/2018 5:57:12 PM

ⓈⓀⒾⓏⓏⓁⒺⓈ

5 Answers

New Answer

+6

You can use this query with distinct to only show non repetative movies. SELECT DISTINCT Movie FROM Title; 

+5

Hi sneeze I want the result to be like: Movie | genre, genre Instead of Movie genre Movie genre So the same movie does not repeat in the results.

+4

Hi, try this: SELECT title, LISTAGG('name', ', ') WITHIN GROUP (ORDER BY name) AS joined_name FROM movies GROUP BY title; It will do the trick for You assuming, the name of the table is "movies" (change to whatever)

0

I do not understand your question. Do you want to assign multiple categories to a film or sort films bases upon categories

0

Hey Skizzles I think you need 2 separate queries & programmatic loops: 1st query to get your list of distinct Titles, then you loop on these results & for each you run 2nd query to get the genres for that specific Title, then you can loop on genres & do what you need with your title & attached genres, then same for next title, etc. 2 very simple queries, 2 nested loops, you're done. Tell me if that makes sense.