Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

301
Vistas
Subquery has too many columns; multiple selections in one select statement

Disclaimer: Sorry if this is a simple question, or a badly worded question. I'm a noob and I didn't know how to word this problem, so I didn't know how to google it.

I have two tables. Math.question and Math.choice.

Math.question contains a questiontext column, as well as correctanswerid, wronganswerid1... and so on.

questiontext            correctanswerid     wronganswerID1    wronganswerid2
(question text          101                 102               103
  goes here)

Math.choice contains the id of the choice, and the choices text.

id     choicetext
101    (text goes here)
102    (text goes here)
...

I want to select questiontext from math.question, and the choicetext. so it'll show something like this:

questiontext     correctanswerText    wronganswer1text   wronganswer2text
(question text)  (choice text)        (choice text)      (choice text)

I have tried this:

select * from math.choice 
where id in (
    select CorrectAnswer_Choice_ID, Foil1_Choice_ID, Foil2_Choice_ID, Foil3_Choice_ID
    from math.question where id=301
);

I got the subquery has too many columns error. I'm not really sure where to go from here.

over 4 years ago · Santiago Trujillo
1 Respuestas
Responde la pregunta

0

You need multiple joins. Something like this:

select c.*, q1. choicetext, q2.choicetext, q3.choicetext
from math.choice c left join
     math.question q1
     on q1.id = c.CorrectAnswer_Choice_ID left join
     math.question q2
     on q2.id = c.Foil1_Choice_ID left join
     math.question q3
     on q3.id = c.Foil3_Choice_ID ;
over 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda