Tema: subquerys
Ver Mensaje Individual
  #3 (permalink)  
Antiguo 26/12/2016, 11:03
schattenburg
 
Fecha de Ingreso: junio-2007
Mensajes: 298
Antigüedad: 16 años, 9 meses
Puntos: 5
Respuesta: subquerys

Hola a todos, aprovecho este tema ya abierto para plantear mi subconsulta. Estoy intentando hacer en Laravel la siguiente subconsulta:

Código PHP:
Ver original
  1. select id_actor_orig1, id_actor_orig2, id_actor_orig3, id_actor_orig4,id_actor_doblaje1, id_actor_doblaje2,
  2. id_actor_doblaje3, id_actor_doblaje4,pel_doblaje.anno, pel_youtube.nom_pel_youtube, pel_doblaje.urlCorta, foto_pel_doblaje
  3. from pel_doblaje
  4.             INNER JOIN pel_youtube ON pel_youtube.id = pel_doblaje.id_pelicula
  5.             where
  6.             nom_pel_youtube like '%".$buscar."%' or
  7.             id_actor_orig1 in (select id from art_youtube where nom_art_youtube like '%".$buscar."%') or
  8.             id_actor_orig1 in (select id from art_youtube where nom_art_youtube like '%".$buscar."%') or
  9.             id_actor_orig2 in (select id from art_youtube where nom_art_youtube like '%".$buscar."%') or
  10.             id_actor_orig3 in (select id from art_youtube where nom_art_youtube like '%".$buscar."%') or
  11.             id_actor_orig4 in (select id from art_youtube where nom_art_youtube like '%".$buscar."%') or
  12.             id_actor_doblaje1 in (select id from art_youtube where nom_art_youtube like '%".$buscar."%') or
  13.             id_actor_doblaje2 in (select id from art_youtube where nom_art_youtube like '%".$buscar."%') or
  14.             id_actor_doblaje3 in (select id from art_youtube where nom_art_youtube like '%".$buscar."%') or
  15.             id_actor_doblaje4 in (select id from art_youtube where nom_art_youtube like '%".$buscar."%')
  16.             order by nom_pel_youtube

Me he leído todos los ejemplos de la documentación oficial pero no consigo montar en Laravel la consulta pero no hay manera.

Me podéis orientar un poco cómo sería en Laravel dicha consulta SQL.

Muchas gracias.

Última edición por schattenburg; 26/12/2016 a las 12:02