简体   繁体   中英

SQL - Result consisted of more than one row

I'm still trying to make my first function, it creates without any errors, but when I try to use it, it gives me error - ERROR 1172 (42000): Result consisted of more than one row

Here's the function -

CREATE FUNCTION kontakti2 (mainigais CHAR(3)) 
RETURNS CHAR(100) 
BEGIN 
DECLARE returnthis CHAR(100); 
SELECT CONCAT(Person.name, Person.lastName, Contacts.mobile, Contacts.email) 
FROM Person JOIN Contacts on Contacts.Person_ID = Person.ID 
JOIN ParentChild on ParentChild.parentID = Person.ID 
JOIN ChildGroup ON ChildGroup.Person_ID = ParentChild.childID 
WHERE ChildGroup.Group_ID = mainigais INTO returnthis; 
RETURN returnthis; 
END//

Here's table schema, just in case - http://www.imagesup.net/dm-713886347846.png

How can I get this function to display several rows?

MySQL无法从函数返回多行,因为它不支持SQL Server中的表值函数。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM