Foros del Web » Programación para mayores de 30 ;) » Bases de Datos General » Mysql »

sql inner join is on find array

Estas en el tema de sql inner join is on find array en el foro de Mysql en Foros del Web. Hola a todos es que tengo un consulta para poder buscar y unir dos tabla Tabla 1 @import url("http://static.forosdelweb.com/clientscript/vbulletin_css/geshi.css"); Código MySQL: Ver original CREATE TABLE ...
  #1 (permalink)  
Antiguo 24/06/2024, 05:33
 
Fecha de Ingreso: junio-2012
Ubicación: En el Mundo
Mensajes: 764
Antigüedad: 12 años, 2 meses
Puntos: 10
sql inner join is on find array

Hola a todos es que tengo un consulta para poder buscar y unir dos tabla

Tabla 1
Código MySQL:
Ver original
  1. CREATE TABLE `output_formats` (
  2.   `access_output_id` int(11) NOT NULL,
  3.   `output_name` varchar(255) DEFAULT NULL,
  4.   `output_key` varchar(255) DEFAULT NULL,
  5.   `output_ext` varchar(255) DEFAULT NULL
  6. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;
  7.  
  8. INSERT INTO `output_formats` (`access_output_id`, `output_name`, `output_key`, `output_ext`) VALUES
  9. (1, 'HLS', 'm3u8', 'm3u8'),
  10. (2, 'MPEGTS', 'ts', 'ts'),
  11. (3, 'RTMP', 'rtmp', '');

Tabla 2
Código MySQL:
Ver original
  1. CREATE TABLE `lines` (
  2.   `id` int(11) NOT NULL,
  3.   `member_id` int(11) DEFAULT NULL,
  4.   `username` varchar(255) DEFAULT NULL,
  5.   `password` varchar(255) DEFAULT NULL,
  6.   `allowed_outputs` mediumtext DEFAULT NULL,
  7. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;
  8.  
  9. INSERT INTO `lines` (`id`, `member_id`, `username`, `password`, `allowed_outputs`, `updated`) VALUES
  10. (0, 1, 'test', 'test', '[1,2,3]', '2024-06-24 11:33:05'),
  11. (1, 1, 'test', 'test', '[1,2,3]', '2024-06-24 11:33:20');

Mi consulta
Código MySQL:
Ver original
  1. SELECT t1.`access_output_id`, t1.`output_key` FROM `output_formats` t1 INNER JOIN `lines` t2 ON FIND_IN_SET(t1.access_output_id, t2.allowed_outputs) WHERE t2.id =1;

Y no me muestra los 3



La zona horaria es GMT -6. Ahora son las 17:59.