0
I have the following scenario: Tables:
Video (id, url)
VideoCategoria (id, id_video, id_categoria)
Categoria (id, descricao)
I need to get the last 120 categories that received videos. On the same cursor I wanted the following fields:
(Video.Url, Categoria.descricao)
Only you can’t repeat the url
video, for example, if a single video enters two different categories then category 1 and 2 are coming with the same Url
.
A solution has already been given here using cursor
and making loops
until finding another video, I tried to do everything in SQL, but I’m not able to do it, someone knows if it is possible?
I am using the id
table Video_Categoria
to pick up the newest records.
UPDATING:
Scheme created on Sqlfiddle as requested in the comment.
you can use the Rextester or Sqlfiddle to create test case and facilitate help ;)
– Rodrigo Gomes