shaddf Posted September 23, 2015 Share Posted September 23, 2015 is it possible to insert data from such a select like so: loop1: WHILE i<in_Dept_TOT DO INSERT INTO _epttbl(Project_id,Dept_id) VALUES(Result,SELECT SPLIT_STRING(in_Deptid, '||',i)); SET i=i+1; END WHILE loop1; Or is it better likeso: loop1: WHILE i<in_Dept_TOT DO SELECT SPLIT_STRING(in_Deptid, '||',i) into myvar ; INSERT INTO _epttbl(Project_id,Dept_id) VALUES(Result,myvar); SET i=i+1; END WHILE loop1; Quote Link to comment https://forums.phpfreaks.com/topic/298278-how-to-use-functions/ Share on other sites More sharing options...
Solution Jacques1 Posted September 23, 2015 Solution Share Posted September 23, 2015 The SELECT keyword in your first query is misplaced. Either leave it out entirely (just write down the function call expression) or enclose the subquery in parentheses. So it's either SPLIT_STRING(...) or (SELECT SPLIT_STRING(...)) Quote Link to comment https://forums.phpfreaks.com/topic/298278-how-to-use-functions/#findComment-1521381 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.