Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
427 views
in Technique[技术] by (71.8m points)

jquery - subquery returned more than 1 value in the following query

I have a stored procedure that does a select * from book table, using a subquery.

My query is :

SELECT A.Titel, A.Preis
FROM Album A
WHERE A.Veroffentlichsdatum < (SELECT A.Veroffentlichsdatum
                               FROM Album A
                               INNER JOIN LiedAlbum ON LiedAlbum.IdAlbum = A.Id 
                                                    AND LiedAlbum.IdLied = (SELECT L.Id 
                                                                            FROM Lied L 
                                                                            WHERE L.Titel IN ('Lifeislife')))

What should I change to get rid of this error?

question from:https://stackoverflow.com/questions/65680117/subquery-returned-more-than-1-value-in-the-following-query

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Not sure what you are trying to do. Since it is the same table why don't you just join them without subquery? The only modification right now I can suggest is the below :

LiedAlbum.IdLied =(SELECT L.Id from Lied L where L.Titel in ('Lifeislife'))

into

exists (select 1 from Lied where Titel = 'Lifeislife' and LiedAlbum.IdLied = Lied.Id)

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...