Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Error Code: 1242. Subquery returns more than 1 row: for carretera Glength

SELECT c1.matricula, GLength(c1.geometry) as longitud 
FROM carreteras c1
WHERE GLength(c1.geometry) = (
    SELECT GLength(c2.geometry) 
    FROM carreteras c2
);

>Solution :

When the subquery returns more than one row, you have to use IN:

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

SELECT c1.matricula, GLength(c1.geometry) as longitude
FROM carreteras c1
WHERE GLength(c1.geometry) IN (
    SELECT GLength(c2.geometry)
    FROM carreteras c2
);

or ANY:

SELECT c1.matricula, GLength(c1.geometry) as longitude
FROM carreteras c1
WHERE GLength(c1.geometry) = ANY (
    SELECT GLength(c2.geometry)
    FROM carreteras c2
);
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading