#1241 - Operand should contain 1 column(s)
Posted by:
Juan Vidal
Date: March 07, 2012 04:41PM
Hi everyone, the last "#1241 - Operand should contain 1 column(s)" topic was closed, my case is a little bit more complex, so i created a new one.
I'm trying to combine data from different tables, the main problem is that they are referential to each other (as you can see in the code) but i keep receiving the message. The common data the main two tables is idLibro.
I have tried the following: SELECT * FROM Libro, LEFT JOIN Registro USING (idLibro) ORDER BY Libro ASC, but obviously I only get the id's; I need the Data of those id's, so i tried to assemble a more complex query. I didn't know where to start so I started with this. My query is as follows:
SELECT Libro.idLibro, Libro.Libro, Libro.Subtitulo, Libro.Volumen, Libro.Detalles, Periodicidad.Periodicidad, Genero.Genero, Objeto_Editorial.Objeto_Editorial, Opcion.Opcion AS Inedito, (SELECT Registro.idLibro, Opcion.Opcion, Original.Original, Directorio.Directorio AS Registrante, Organismo.Organismo, Unidad.Unidad, Registro.Ingreso, Registro.Observaciones FROM Registro INNER JOIN Opcion ON Opcion.idOpcion=Registro.Protocolo INNER JOIN Original ON Original.idOriginal=Registro.idOriginal INNER JOIN Directorio ON Directorio.idDirectorio=Registro.Registrante INNER JOIN Organismo ON Organismo.idOrganismo=Registro.idOrganismo INNER JOIN Unidad ON Unidad.idUnidad=Registro.idUnidad) AS Detalle_Subcomite FROM Libro INNER JOIN Periodicidad ON Periodicidad.idPeriodicidad=Libro.idPeriodicidad INNER JOIN Genero ON Genero.idGenero=Libro.idGenero INNER JOIN Objeto_Editorial ON Objeto_Editorial.idObjeto_Editorial=Libro.idObjeto_Editorial INNER JOIN Opcion ON Opcion.idOpcion=Libro.idOpcion ORDER BY Libro ASC
Can anyone help me to resolve this puzzle? Thanks in advance. =)