Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

293
Views
La subconsulta tiene demasiadas columnas; selecciones múltiples en una declaración de selección

Descargo de responsabilidad: lo siento si esta es una pregunta simple o una pregunta mal redactada. Soy un novato y no sabía cómo expresar este problema, así que no sabía cómo buscarlo en Google.

Tengo dos mesas. Math.question y Math.choice.

Math.question contiene una columna de texto de pregunta, así como un ID de respuesta correcta, un ID de respuesta incorrecta, etc.

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

Math.choice contiene la identificación de la opción y el texto de las opciones.

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

Quiero seleccionar el texto de la pregunta de math.question y el texto de elección. por lo que mostrará algo como esto:

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

He intentado esto:

 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 );

Obtuve el error de la subconsulta tiene demasiadas columnas. No estoy muy seguro de adónde ir desde aquí.

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

Necesita múltiples join . Algo como esto:

 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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!